Dynamic User Control Inside Tab Control - does NOT fire events

I have a web aplication with one web form and one user control. The form contains a tabcontiner with NO tab panels. On each load, one tab panel is dynamically added to the web form and the user control is dynamically added to the tab panel.

The user control contains a button. It raises an event on its click event.

 Once you click on the button, the event is never called.

This is strange because the code works perfectly if the user control is dynamically added inside a panel instead of a tab control.

Any ideas?



private void makeTabs()
                //Dynamic Tab
                TabPanel tempPanel = new TabPanel();
                tempPanel.ID = "Tabb1";
                tempPanel.HeaderText = "Tab 1";
                tempPanel.Width = Unit.Pixel(500);

                //Dynamic user control with grid
                WebUserControl1 userControl = (WebUserControl1)LoadControl("WebUserControl1.ascx");
                userControl.ID = "TabbControl";
                userControl.Grid.ID = "TabbGrid";
                userControl.Grid.DataSource = dataArray;

                //Add tab to tab container 

                TabContainer1.ActiveTabIndex = 0;


                //Attach event
                userControl.GridViews += new WebUserControl1.GridViewsEventHandler(HandleGridViewsEvent);
            catch (Exception ex)

6/14/2008 3:51:32 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 40

Hi friend,

After read your code, I did not find any button in it, also I can not see any Event attach any buttons.

So could you give me more code here?

Hong Gang

Hong-Gang Chen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
6/18/2008 9:08:58 AM

Similar Artilces:

Custom User Controls and dynamically created web controls events not firing
I have a peculiar problem and since I am just starting to use .net I am confident I am doing something wrong, but I can't see it and I've wasted a lot of time so far trying to figure it out. Hopefully one of you can figure it out. I have a custom User Control and I am dynamically creating a RadioButtonList. If I remove the custom user control from the page the RadioButtonList works as expected and correctly. However, once I add the custom control, it does not fire the SelectedIndexChanged event. Below is some code. If all I do is remove: "<UC:TOPMENU id="TopMenu1"...

Web User Control dynamically generated control events won’t fire.
I hope someone can give me a hand on this one.   This is what I am trying to do:   We need to create a report. We are using a Repeater control to generate a custom grid. The columns and data fields won’t be known until run-time.   I’ve created a WebUserControl which contains a repeater control.   At run-time, I dynamically create templates for the header and data items. On the header template I want to use a LinkButton so that data can be sorted when the user clicks on one of the header columns.   In my Header Template class, I have a reference to a list o...

Problem in accessing web form data in user controls when create user control dynamically
HI. I have a problem using web user control. I designed a user control named NewsForm. This user control contains some web form elements like <asp:textbox>. When I add it in an .ASPX page, all things may be true. I can know which user filles in textbox (for example and other controls) <%@ Register TagPrefix="uc1" TagName="NewsForm" Src="NewsForm.ascx" %> and <UC1:NewsForm id="newsForm" runat="server"></UC1:NewsForm> But when i create it in code behined dynamically, however user control has web form controls but their value are blank for example //aspx co...

Event not firing with Dynamic Controls in a Custom Web Control
I'm creating some LinkButtons on the fly (on Load) and they show up just fine.  The problem is that the AddHandler event I created is not firing.  I'm at a loss...have read a ton of articles today, but just can't figure this one out.  Please help a newb! :-)Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) MyBase.OnLoad(e) EnsureChildControls() If Me.Page.IsPostBack Then Me.Units = Me.rblUnits.SelectedValue 'If there is text in the txtSearch TextBox, then search for the new loc...

Dynamically loading user control to a gridview
Hello,I know there are many posts about loading user control dynamically and events which not fire. I tried  everything suggested but nothing helped. The difference in my example is that I am loading the user control into a specific line in a grid view after the user clicked on a button.So, the containing object in this case is DataControlFieldCell but it is a difference one on every click of the user.I tried to to set the ID of the user control on the page load of the control (this.ID = "MyControl1";) and I am loading the control on post back in the page_load of the parent pa...

Tab Control
I have searched the forum and I cant seem to find the answer to my question, although I have tried some of the hints I have found with no luck....Can someone show me a working sample (with source code) of a page with a TabContainer and several tabs, with each tab having a user control, but the controls are not added/initialized/shown until the appropriate tab is shown/clicked?Something like this forum's "Write a New Post" page, where the tabs load after I click on them, and an animated picture displays to show that its loading.The solution needs to add user controls to the page...

Web user control inside update panel replace with another web user control
 Hi there. I have a page with a menu. an and then the content. My thing is. That i have the update panel, and inside that i have a regual panel in which i add the Web User Controls i need. Which all works fine. My problem is. That i i have a submit funcion on almoast all the Web User controls. What i would like is that i inside that update panel, can dispose the original Web user Control and then add a response Web User Control. In normal language. Is there a way that i can load one web user control into antoher and then disposose the original? Thanks in advance hello. well, what ...

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

User Control Issue
Dupelicate post dancioffi: Dupelicate post Please refer to this: http://forums.asp.net/t/1398304.aspxGary yang - MSFTMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

How do you expose an event from a server control within an user control on an web form?
I have a calendar inside of an user control Simple.ascx The user control is sitting on my web form Simple.aspx. How do I access the VisibleMonthChanged event from my web form Simple.aspx? Is it possible? Yes Create Event in usercontrol which fires on page when VisibleMonthChanged event fires on usercontrol. Jigar Desai-----------------------Do not forget to "Mark as Answer" on the post that helped you. Ok, I created the event Public Event MonthChanged() in Simple.ascx.vb. Then I add the follow to Simple.aspx.vb Private Sub Simple_MonthChanged() Si...

User Controls
Hi,I'll make this senario somewhat generic. I have an ASPX Page, within the aspx page I have two web user controls. "uc1" contains a datalist, on uc2 I have a form with a submit button. I want to fire the databind of the datalist in uc1 from the submit button on uc2, how can I do this?Thank you, New Orleans Hornets Season Ticket Holder! "uc2" should raise an event that your Page can handle. Then, in the Page handler for this event, you can call the DataBind method of "uc1".Thanks, EdMicrosoft MVP - ASP/ASP.NET  Is this where delegates come into...

Web User Control to Web User Control...
Hi, I have 2 User controls on a page and want Control1 to call a method of Control2. Is this Possible? Example: Con1 = Datalist showing products, each with a Quantity Box and a Button. Con2 = Repeater showing Cart Preview (name, Price) in page.aspx. When I click on the button on the DataList in Con1 it adds the item into the Session based Cart. However it does not update the Cart Preview. I need to call BindPreview() in Con2 in order to update the Cart Preview... Does that make sense? argh! any help much appreciated! PeteWeb Design Nottingham, UK Well I can call BindPreview() from m...

Dynamically added user controls.. Restoring user control events ...
Hello, i ve made a simple aspx page to focus on the problem..In the aspx page i have a button that when it is pressed a user control is added dynamically, So if you press the button twice , two user controls will be added..Here is how i implement it :When a user control is added ,i add it to an arraylist (which contains all the  user controls that have been inserted to the page ) and this array list is then added to the session.So when the page is loaded ,i retrieve that arraylist back from the session i iterate through it ,and i enter again to the page all the previous added user contr...

How to access individual controls from a form containing the web user control containing those controls
 Below is a block of code in my .aspx form named default.aspx. In this form I load a web user control. I then add it to a place holder control.(Lines 3 and 4 below) So how do I access the individual controls in my web user control? I want to set the properties on those controls, but I am baffled as to how to access the control. For example I have a text label control named "label3". How do I access this control. Because for example, under certain situations I want to hide that control. ( Label3.Visible = false;)  1    if(!Page.IsPostBack) 2&nb...

Web resources about - Dynamic User Control Inside Tab Control - does NOT fire events - asp.net.web-forms

Dynamics - Wikipedia, the free encyclopedia
Brownian dynamics , the occurrence of Langevin dynamics in the motion of particles in solution (e.g. a grain in water, as was first seen by Brown); ...

Datacenter Dynamics
Datacenterdynamics for data center information, conferences, news, videos, whitepapers and reports globally

Dynamic Chiropractic - chiropractic, news, articles, research & information for chiropractors - Find ...
Dynamic Chiropractic - chiropractic, news, articles, research & information for chiropractors - Find a Chiropractor

Walmart's Everyday Low Prices Face Amazon's Dynamic Price Push
... low prices" strategy is becoming an everyday price-adjustment strategy. In what seems to be a direct response to Amazon's sophisticated dynamic ...

General Dynamics Corporation Delivers The Future of American Shipping
American Petroleum Tankers receives delivery of first ECO class tanker from General Dynamics\' NASSCO.

Mea Culpa: Confidence Proceedings Edition: I Really Do Think Dynamic Scoring Is a Bad Idea
... *Brad DeLong noted that when he was a Treasury political appointee, one of the Treasury career staff economists lectured me him about dynamic ...

dynamic billboards to up your photo game
NYC is one of the most photographed places in the world, especially this time of year. And while Instagram has made every one of us feel like ...

SNL perfectly captured the dynamics of the Republican presidential race
The "Saturday Night Live" recap of the latest Republican presidential debate reflected fairly accurately the state of the GOP primary. Beck ...

Yolanda Foster explains her divorce: ‘chronic illness changed our dynamic’
... is extremely challenging, not only for the person that’s sick, but also for the caregiver,” Foster admitted. “It for sure changed the dynamic ...

CES 2016 TV tech: 4K yawns, high dynamic range dawns
... Show in Las Vegas this January, TVs with 4K resolution are old hat. So what's new hat? The next-generation TV technology known as high dynamic ...

Resources last updated: 12/20/2015 8:45:43 PM