I am using a Custom control in my aspx page. This custom control has a error message label. I need to display this label from the code behind on button click. How can i achieve this.
Button and custom control is in Update panel.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume that in the custom control you have the label you want to show and the button you have on the update panel outside the custom control.
If so, you should create a public method in your Custom control, something like
public void ShowError(string message)and when you do the button click you call this method passing the text to display. In the method implementation inside the custom control you will assign the message text to the label and display the label if not visible. This should actually work either you use an update panel or not as long as both button and custom control are at the same time outside or inside theUpdatePanelbut not one in and the other out.