Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - user control load event does not fire on postback

 
Thread Tools Search this Thread
Old 04-28-2004, 11:18 PM   #1
Default 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








Marcel Balcarek
  Reply With Quote
Old 04-29-2004, 06:52 AM   #2
Ashish M Bhonkiya
 
Posts: n/a
Default Re: user control load event does not fire on postback
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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46