473,327 Members | 2,094 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.

user control load event does not fire on postback

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


Nov 18 '05 #1
1 2784
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" <ma*************@REM-OVEMEtoxicall.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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


Nov 18 '05 #2

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

Similar topics

7
by: moondaddy | last post by:
I have a user control being used instead of a frame page. when the user clicks on a menu item I need to send the ID (integer value) of that menu as a parameter in the postback of the user control...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
1
by: Robert Howells | last post by:
Perhaps I'm just too new at this to pull it off, or perhaps it's just bad architecture. I'd appreciate some feedback on the the wisdom (or lack thereof) in attempting the following: I'm not new...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
1
by: Rotsey | last post by:
Hi I have a ASP.NET 2.0 problem I hope you could help me with, I have had problems trying to find an answer to this I will be brief. I have a user control that has only a <asp:table> tag on...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
2
by: HammRadio | last post by:
I am exploring converting my web app (current Framework 1.1) to Framework 2.0. Everything went smoothly save for one item. To reduce the trips to the database, when loading user controls (like a...
2
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hello, I have a page that contains a user control that is nested within other user controls... the nesting is quite deep, not sure exactly how ddep but there is a control inside a control inside...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
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.