Re: Repeater Not Populating Items on PostBack
MIke Collins <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.web |
|---|---|
| Message-ID | <072601c729df$66fe5be0$0200a8c0@mike> |
I'm not sure if this was answered, but I have run into this problem in the past. The problem is that sometimes in a post back ot in an event handler that some of the controls do not seem to have their values set. Given that you don't know how to get all of the values without having to get them from the form variables directly. There is a built in solution that fixed this problem. EnsureChildControls() http://msdn2.microsoft.com/en-us/library/system.web.ui.control.ensurechildco ntrols.aspx You want to place that call [EnsureChildControls()] inside your event handlers. This will make sure that all child controls for this page exist and have retreived their values from the post variables before you try to use them. I hope this helps everyone. Mike -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of David B. Bitton Sent: Sunday, December 03, 2006 8:08 PM To: [email protected] Subject: Re: [DOTNET-WEB] Repeater Not Populating Items on PostBack Shawn, That is exactly what was happening. I needed to handle it in an event handler. This was being called later by Page_Load. Tx. -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of Shawn Wildermuth Sent: Thursday, November 30, 2006 2:10 AM To: [email protected] Subject: Re: [DOTNET-WEB] Repeater Not Populating Items on PostBack Most likely you are re-populating the data bound items of the repeater before your events fire. What are you doing in Page_Load? (Did you forget a IsPostback() check?) Thanks, Shawn Wildermuth Wildermuth Consulting Services, LLC http://adoguy.com C# MVP, MCSD.NET, Author and Speaker -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of David B. Bitton Sent: Thursday, November 30, 2006 1:53 AM To: [email protected] Subject: [DOTNET-WEB] Repeater Not Populating Items on PostBack I have a Repeater control in 2.0 that is not filling it's Items collection on postback even though ViewState is enable for the page and the Repeater. Why would this be? =================================== This list is hosted by DevelopMentor. http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com