Access UserControl

  • Thread starter Thread starter Gabriel
  • Start date Start date
G

Gabriel

Hello,

I created a UserControl (MyUserControl.ascx). At design time I added this
control the a page (MyPage.aspx). No problem when I execute the page I see
it.

I'd like access to some method and properties from MyPage.aspx.cd (first
form Page_load but may be others).

Could you tell me how to access the method of my UserControl ?

Regards,
 
You need to create the object on it in the code.
Keep name of the object defined and object in html file same.

Niraj
 
You need to create the object on it in the code.
Keep name of the object defined and object in html file same.

Do you mean create object at runtime ? Do you have an example ?

Thanks,

Regards,
 
while there are some hacks, the proper way is to define an interface (in
an appcode class file), have the user control implement the interface,
then cast the control to the interface when you need to access the
interface properties.


-- bruce (sqlwork.com)
 
in message
while there are some hacks, the proper way is to define an interface (in
an appcode class file), have the user control implement the interface,
then cast the control to the interface when you need to access the
interface properties.

Thanks Bruce, I did that's work. :)

I have an another question. MyUserControl.ascx is dropped in a MyPage.aspx
page. In this usercontrol control there are 2 textbox and 1 button. When I
click on the button depeding some result with the 2 Textbox, I do a
"Response.Redirect". In the MyPage.aspx, how can I access to the control
*before* the redirect ?

Regards,
 
Back
Top