Click here to Skip to main content
15,936,821 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi , i create a User Control with 6 Buttons.Which includes (NEW ,Edit , Delete , SAVE , CLEAR ,PRINT). by default Edit and DELETE buttons are Disabled.What i need is when i add this user control to a page. need to enable that Edit and Delete button when select a row in the Grid view.can someone tell me how to declare a method to enable that buttons from a web form(.CS file)??? Thanks a Lot!!!! i guess i 'll need a method for achieving that task.if someone could help me on this matter, that would be a great help for me.Thanks in advance!!!

just make btnUpdate.enable = true at the event and turn autopostback to true.
Share this answer
I suggest make public properties instead inside user control

public bool ButtonEnabled
  btnSubmit.enabled = value;
  return btnSubmit.enabled;

this way you can do it from code in the page like

usercontrol1.ButtonEnabled = false;

and even from the aspx markup of page as

<uc:usercontrol id="usercontrol1" buttonenabled="false" xmlns:uc="#unknown" />

Tell me if my understanding is not correct and i will try to refine the solution.
Share this answer
Hesha 30-May-12 10:55am    
Thanks a lot Rahul!!! That's works perfectly!!!!Again Thanksa Lot!!!
VJ Reddy 4-Jun-12 5:18am    
Good answer. 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900