disable client page buttons using admin page button... [Resolved]

Posted by Ramu02 under ASP.NET on 2/28/2012 | Points: 10 | Views : 1299 | Status : [Member] | Replies : 5
Hi guys,

In my application I have 3 client pages and 1 admin page ...each client page have 1 insert(database) button. Admin have 2 buttons like disable and enable. If the admin click on disable button all the client page buttons will be disable and admin click the enable button all the client page buttons will be visible ....can u guys please help to do it ...

THANKS




Responses

Posted by: Ramu02 on: 2/28/2012 [Member] Starter | Points: 25

Up
0
Down

Resolved
Thanks for u r reply ....But I did it by using sessions like ....

admin code ..
protected void Button1_Click(object sender, EventArgs e)
{
Session["DisableControls"] = false;
}
protected void Button2_Click(object sender, EventArgs e)
{
Session["DisableControls"] = true;
}


client page_load code ....

if(!this.IsPostBack)
{
if (Session["DisableControls"] == null)
Button1.Enabled = true;
else
Button1.Enabled = (bool)Session["DisableControls"];
}

...Once again thanks ...

Ramu02, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pradeepkumar417 on: 2/28/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi,

Thank you

Thanks & Regards,
Software Engineer,
Pradeep Kumar

Ramu02, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pradeepkumar417 on: 2/28/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

For this you have to maintain a database table with a single field. By default you have to set the value as true in db. When admin click on disable button you have to update that field to "false" or if admin click on enable button you have to update that field to true.

Now you have to check in page load event of client pages whether that field is true or false. Based on that you have set the Enabled property of button.

Thanks & Regards,
Software Engineer,
Pradeep Kumar

Ramu02, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pradeepkumar417 on: 2/28/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

With sessions it will not work. Session will expire when you closing the application or if you clear the browser history. So when you open the client page again the button will come up to default property. Check it once whether it will work or not with sessions.

Thanks & Regards,
Software Engineer,
Pradeep Kumar

Ramu02, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ramu02 on: 2/28/2012 [Member] Starter | Points: 25

Up
0
Down
yes U r right .....
so I will use DB..
Thanks for immediate reply ...Thanks a lot ..

Ramu02, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response