D
Dan
I have built a user control that displays the header on a
web forms. It has a public property ("Msg") that I can set
to display error messages from the main web form in a
consistant way.
In a very simple example I have a web form that has the
header user control, a button, and a text box. I can set
the public property "Msg" of the user control on the
Page_Load event of the web form and it works just fine,
but......
...here is the problem. I have a Button_Click event that
tries to set the property of the user control ("Msg") to
the value of the text box, but the user control never
seems to pick this up.
I think this has to do with the order of events firing. It
seems that when you click the button, the form is posted
to the server... then the page_load event fires... then
the button_click method is called. It also appears that
the user control is rendered before the button_click
event, so I am not able to set the property at that point.
Is my theory correct? Is the user control in fact rendered
during the page_load event of the calling webform? Is
there any way to set public properties of user controls
from a button click event?
Any help is greatly appreciated.
-Dan
web forms. It has a public property ("Msg") that I can set
to display error messages from the main web form in a
consistant way.
In a very simple example I have a web form that has the
header user control, a button, and a text box. I can set
the public property "Msg" of the user control on the
Page_Load event of the web form and it works just fine,
but......
...here is the problem. I have a Button_Click event that
tries to set the property of the user control ("Msg") to
the value of the text box, but the user control never
seems to pick this up.
I think this has to do with the order of events firing. It
seems that when you click the button, the form is posted
to the server... then the page_load event fires... then
the button_click method is called. It also appears that
the user control is rendered before the button_click
event, so I am not able to set the property at that point.
Is my theory correct? Is the user control in fact rendered
during the page_load event of the calling webform? Is
there any way to set public properties of user controls
from a button click event?
Any help is greatly appreciated.
-Dan