To access a control placed in a web user control which is loaded during page load in button click event

How can I access a control in a web user control in a button click event , the user control is loaded in page load.


Thanks & Regards,
Abhiram Reddy Mekha.
0
AbhiramReddyMekha
11/18/2008 4:22:55 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

2 Replies
1457 Views

Similar Articles

[PageSpeed] 33
Get it on Google Play
Get it on Apple App Store

Try checking this...

http://microsoft.apress.com/asptodayarchive/73869/event-handling-between-custom-user-controls-that-are-loaded-at-run-time
http://aspalliance.com/565_Dynamic_Loading_of_ASPNET_User_Controls
http://www.beansoftware.com/ASP.NET-Tutorials/Controls-Run-Time.aspx
http://stackoverflow.com/questions/92792/user-control-created-dynamically-not-able-to-handle-events-on-postback
http://www.codersource.net/asp_net_user_controls_azam.aspx
0
dreamz
11/18/2008 5:36:37 AM

Hi,

Based on your description, you want to access a control nested in a user control on the host page.

A user control is a composite control and all its child controls and script serve as a unit. So, we can't directly access the nested controls in it.

However, we can expose some properties for our user controls and make them public. We can get some information of the nested controls through these properties.

For instance: assume a TextBox control is nested in a user control we can define a property like this to get the Text property of the TextBox control.

 

 public string getText
    {
        get
        {
            return TextBox1.Text;
        }
        set
        {
            TextBox1.Text = value;
        }
    }    
 

Have a nice day!

 


Forward Sun
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Forward
11/23/2008 12:55:37 PM
Reply:

Similar Artilces:

Web page .aspx is slow when loading. Pages have web user controls on them that are loaded dynamically
I have written a web application using VS 2003. Several of my forms have web user controls on them. The controls are loaded dynamically at runtime. The problem is that the web pages are very slow to load. Does anyone know if there is a way to speed up the pages being loaded into the browser? Here is an example of some code I use to dynamically load the controls:  private void Page_Load(object sender, System.EventArgs e)  {   // Put user code to initialize the page here   // Put user code to initialize the page here    Co...

Dynamically loaded Web User Control .ascx button click event handler not called on second time click
I have an ascx control (that performs actions for an entity) being added dynamically to accordion panes, and then the panes are added to an ajax accordion control, so that the accordion can contain multiple panes with each pane containing one ascx control. The ascx control contains a delete button which removes the entity from the database. Once the entity is removed, I need to reflect this deletion in the parent page by removing the accordion pane from the accordion. To do this I created a delegate function and which is called from the parent page to rebind the accordion and hence not d...

access controls on web user control x from web user control Y
I have 2 web users controls in a page and I would like to get or set the selected values of a few dropdown boxes on web user control X from web user control Y and I also would like to know how to access functions that are on a web user control X from a web user control Y, is this possible? How can I do it? User can access and set the values of the User Control from .aspx page through properties,using javascript and in code-behind of aspx page.The details of it are shown below Using PropertiesIf the Sample.ascx control has two textboxes and submit button.You can access the valu...

Load Web User Control on Page Load
I have a web page, with a header and footer web control and it all works great. What i want to do is load a web user control on load of the page. Let me explain a little more. If i have a links page (links.aspx) with 3 web user controls. header.ascx, footer.ascx, and link.ascx. When i click on a link thats contained in the link.ascx i want to use the same links.aspx (mostly for the header and footer controls) but i want to load another web user control in the same spot where the old link.ascx is. Is this possible? Thanks!.. :: kleptos :: .. <%@ Page %> <%@ Regist...

Web user control loading if page is been loaded
I have a User Web control with a updatepanel. The user webcontrol does take some time to load, so I want to wait with loading the User Webcontrol Till the page is been loaded and showed to the user. How can I make do this ? This example explains about on demand UI loading. I think this is what you are looking for http://msmvps.com/blogs/omar/archive/2007/11/09/on-demand-ui-loading-on-ajax-websites.aspx  http://devarchive.net/loading_user_controls_using_with_page_methods.aspx (Loading User Controls Using ASP.NET AJAX Page Methods ) http://forums.as...

Web User Control - Button Click
I have a web user control which is has one Button control on it. It has a event for handling the click... if I put this user control ( button ) at the top  of the page, the click event does not get fired just page is refreshed...but where as if I move to the bottom of the page, ButtonClick is fired ???? I am completely clueless why is this change of behavior with respect to the position of the control?? Thanks. could you show us the code that you have problem with ...   Here is the code ( i have taken out the unwanted part of the page ) Please note that the bSave does ...

Web User Control loaded into updatePanel click events causing entire page to reload
 Hi im sorry for having to ask this but i have tried numerous appraoches and i cant figure out where i am going wrong, i have created a web user control call sampleControl i load this dynamically into my main page which contains a panel, i create the sampleControl for the number of records pulled out of my database based on a stored procedure.The sampleControl has an updatePanel containing everything else within the web usercontrol, and the page the controls get loaded onto have a scriptmanager , Everything up until this stage is working fine i have methods to set images etc the images ...

How can I control load sequence of web controls in a web page?
Hi, How can I control load sequence of web controls in a web page? Thanks. For the most part, the load sequence on a web page is not relevant since all controls must be present before the page can be used. Could you provide more information as to what you're trying to do?Christopher Reed"The oxen are slow, but the earth is patient." Hi, As far as I know, we have no luck to control the load order of the Web controls on a page. However, if we need to load some controls under given conditions, we can achieve this by adding them dynamically instead.Forwa...

controlling an object in a web control from the page the web control is placed in
I have created a web control in vb.net that has an image button and an image. when it loads the image button is visible and the image is not. I want to be able from the page which "includes" the web control to set the image button to invisible and the image to visible. When I tried this, the main page didn't recognise the image button or the image (both < asp: objects). help would be gratefully appreciated. oh yeah, it's inline code so any code behind stuff will just confuse me ;) Some code please.-- Justin Lovell...

tabs control .. how to load web control on user click?
hello , i have a simple question how do i load a control like ( LastNews.ascx )  to a tab  when the user click on it?  Hi,You may achieve it in this way:1. Add a UpdatePanel into the tab2. Add a invisible button in it as a trigger for the UpdatePanel3. In the click event of the button, load the UserControl into the UpdatePanel4. Add  an event handler to the activeTabChanged event of the tabContainer.5. In the handler, trigger the click event of the invisible button Hope this helps. ...

Javascript inside "web user control" not run if load "web user control" under ajax UpdatePanel
I have this problem and please if some can help me, I place here a sample code to see, but in my real problem the web user control have a very complicate javascript. I have a web user control that have some javascript inside, let say for example.1 <script type="text/javascript" > 2 function RunMe() 3 { 4 alert("Client id:<%=ClientID%>"); 5 } 6 </script> 7 8 9 <a href="javascript:RunMe()">Run javascript</a> a simple call to a simple javascript, inside the web user control And now I have...

User Controls loading on a web tab every page load
I have user controls loading every single time I run a page load.  I was wondering if anybody had any ideas for dynamically loading these controls? I can achieve this but with my web tab that I currently have my tabClick event comes back on the page load and I would need to know the the selected tab before initialization of the page in order to keep the controls persistence.  Any ideas would be greatly appreciated.  I have about exhaust all possibilities with this one. Add the controls to the page in Page_Init event. And everything should work fine. Dynamically added control...

Single page with multiple user web controls VS Multiple page with specific user web controls
I have a question regarding single page with multiple user web controls vs multiple page with specific user web controls   Option 1: I am of the opinion to have multiple pages with specific user web controls and use an object to store all the information as the user navigates through the application. And finally at the end, read this object and save all the information to the backend database.   Option 2: My respected team member suggests that we have only one page, with all the specific user web controls and not use an object, instead show/hide the user web controls based ...

Error when Loading Dynamic UserControl from current User Control's Button Click event Calling Page Event
Hi,I have a panel that I load user Control in no problem.  The problemarrises when I do a post back on one of these user controls.  I havebutton it does a click event.  In this click event I will do somedatabase updates, then I will use reflection to call a method in theparent (this.page) to load the new user control.  Its at this pointafter it loads the new user control that it throws the error "Thecontrol must be placed inside a form tag with runat=server".Now, my methods that managers the user control works.  I am able toclick on the parent page menu and...

Web resources about - To access a control placed in a web user control which is loaded during page load in button click event - asp.net.web-forms

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

TERROR IN JAKARTA: 'Situation under control' after explosions, gunfire erupt in Indonesian capital
At least six people are dead, including three police officers, after several explosions at the Sarinah shopping mall in an apparent multi-site ...

DFES downgrades bushfire in Dunsborough as it is contained, but not under control
A BUSHFIRE south of Dunsborough has been contained but is not yet under control.

WA fires: threatening Jindalee blaze brought under control
A fire that was at one stage a threat to lives on homes in Jindalee on Thursday has been brought under control.

Queensland police shut down out-of-control party in Berserker, Rockhampton
Police shut down a party of 150 young people who had gathered at a house in Berserker, Rockhampton on Friday night.

Contextual and Granular Notification Controls
... written a lot about notifications, at one point calling the notifications screen “my home screen.” But I don’t like how we are forced to control ...

ESI cost control and networks
There is an interesting discussion thread on Twitter about how the way Medicare for All saves money is by significantly reducing provider, device, ...

While No One Was Watching, Obama Took Control of the Courts
... and President Obama’s legacy.” It didn’t favor conservatives but there was a dramatic shift to the far left. The appellate is under the control ...

Sanders Backs Gun Control Legislation Ahead of Democratic Debate
Hillary Clinton's campaign calls her rival's move a "debate-eve conversion."

Apple has landed a very rare sponsorship deal to ensure it has control of the hottest ticket in San Francisco ...
Apple has signed up for the first time to become a sponsor of the Super Bowl Host Committee, Daniel Roberts at Yahoo Finance reported. It's ...

Resources last updated: 1/17/2016 5:24:17 PM