![]() |
|
|
|||||||
![]() |
ASP Net - user control load event does not fire on postback |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
I create a user control dynamically:
Dim newCriteriaControl As CriteriaTextBoxUserControl = CType(Me._page.LoadControl("CriteriaTextBoxUserCon trol.ascx"), CriteriaTextBoxUserControl) myContainer.Add(newCriteriaControl) and the user control's load event executes on initial executon of the page. On a POST of the same page, the control is added as above, but the load event is not firing, nor is prerender. What's going on? How can I get code to execute in the user control on a page postback? Marcel Marcel Balcarek |
|
|
|
|
#2 |
|
Posts: n/a
|
Hi Marcel Balcarek,
I have Tried to reproduce your problem but am not facing any problems. i have created one usercontrol and am dynamically adding it in the page load event of the page and the event is getting fired for me. you may check this code if you are missing something. UserControls' Page Load if (Page.IsPostBack) { Response.Write("This is a PostBack... haahaah") } else { Response.Write("This is not a PostBack...") } Page's Page_Load Dim myControl As CriteriaTextBoxUserControl = CType(Me.LoadControl("CriteriaTextBoxUserControl.a scx"), CriteriaTextBoxUserControl) PlaceHolder1.Controls.Add(myControl) PS: also check that you are not missing to add the user control in the page_load's Postback. Regards Ashish M Bhonkiya "Marcel Balcarek" <> wrote in message news:%... > I create a user control dynamically: > Dim newCriteriaControl As CriteriaTextBoxUserControl = > CType(Me._page.LoadControl("CriteriaTextBoxUserCon trol.ascx"), > CriteriaTextBoxUserControl) > > myContainer.Add(newCriteriaControl) > > and the user control's load event executes on initial executon of the page. > On a POST of the same page, the control is added as above, but the load > event is not firing, nor is prerender. > > What's going on? How can I get code to execute in the user control on a page > postback? > > Marcel > > > > > > Ashish M Bhonkiya |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Load .aspx page on another frame from TreeView Event | Sangeeth | Software | 0 | 06-25-2009 09:20 AM |
| Event Viewer question | bootmgr | MCITP | 0 | 10-10-2008 02:22 PM |
| Mind Control and CIA'S BOURNE IDENTITY PLOT | soleilmavis@gmail.com | DVD Video | 2 | 08-03-2007 09:54 PM |
| Ajax Atlas not working in User Control | faiq | Software | 0 | 09-16-2006 08:28 AM |
| ASP.NET: User Control Events is Not Displaying in a Property Window | BabuA | Software | 0 | 09-14-2006 05:44 PM |