Access UserControl

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,
 
N

Niraj Ranka

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

Niraj
 
G

Gabriel

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,
 
B

bruce barker

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)
 
G

Gabriel

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top