473,327 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Access UserControl

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,
Jun 27 '08 #1
4 844
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" <no****@nospam.comwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
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,


Jun 27 '08 #2
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,
Jun 27 '08 #3
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 wrote:
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,

Jun 27 '08 #4
"bruce barker" wrote in message
news:up**************@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,

Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: athlonman | last post by:
Hi all!! II'm trying to set the Text of a TextBox in "Form1" when I click a Button in a UserControl. My code is: : public class Form1 : System.Windows.Forms.Form { public...
2
by: paul meaney | last post by:
All, myself and another developer have been staring blankly at a screen for the past 48 hours and are wondering just what stunningly obvious thing we are missing. We are trying to load up 2...
6
by: William Parker | last post by:
I have a web control I made called header.ascx. It has its own properties and methods I defined. But I cannot figure out how to access this control from my code behind page. I can create the...
9
by: Anders K. Jacobsen [DK] | last post by:
Hi I have this that adds some usercontrol (UCTodays.ascx) to a placeholder foreach(A a in B){ UCTodays ucline = (UCTodays )LoadControl("UCTodays.ascx");...
2
by: N. Demos | last post by:
I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page...
0
by: Filippo Bettinaglio | last post by:
tool: VS2005 C# I have a Windows Forms UserControl hosted within Internet Explorer According to MIcrosoft documentation: You can access the HTML DOM representing the page on which your...
2
by: Filippo Bettinaglio | last post by:
Hi, I use, VS2005 C# I have a Windows Forms UserControl hosted within Internet Explorer According to MIcrosoft documentation: ...
5
by: Paul | last post by:
I have a MasterPage that has on it several UserControls (*ascx files). I wish to control the visibility of the controls on the content pages according to some parameter (for example on a user...
4
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I have a user control that is designed as below. I am creating these User Controls Dynamically in another form. They are multiple types of User Controls all with a common Interface so I can...
0
by: anileshlakhtakia | last post by:
Hi, I am getting this problem and i am not able to understand what is the logic behind this.My Problem is i have 2 user controls on my application having same namespace lets say...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.