Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Access UserControl

1 view
Skip to first unread message

Gabriel

unread,
May 3, 2008, 2:26:05 AM5/3/08
to
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,


Niraj Ranka

unread,
May 3, 2008, 5:42:11 AM5/3/08
to
You need to create the object on it in the code.
Keep name of the object defined and object in html file same.

Niraj
"Gabriel" <nos...@nospam.com> wrote in message
news:uIhGraOr...@TK2MSFTNGP03.phx.gbl...

Gabriel

unread,
May 3, 2008, 10:15:56 AM5/3/08
to

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

bruce barker

unread,
May 5, 2008, 12:18:02 AM5/5/08
to
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)

Gabriel

unread,
May 7, 2008, 12:57:28 AM5/7/08
to

> "bruce barker" wrote in message
> news:uptyLcmr...@TK2MSFTNGP06.phx.gbl...

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

0 new messages