This is a discussion on problem when I use this.DataBind() in content page..? within the C# Programming forums, part of the Software Development category; Work around for Master page problem when we use this.DataBind() in content page....
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| There is a common problem with the master pages, when you use this.databind() in content pages. The problem is when you submit the content page the below sort of actions will occur. 1. Content page is submitted, posting controls' values to the server. 2. Content page's Load event fires. 3. Master page's Load event fires, this.DataBind() is executed. It happens before any ViewState saving. 4. this.DataBind() causes repopulation of the data-bound Repeater control on the content page. 5. ViewState for controls is still blank at this point, so all properties are reset to an empty string. 6. ViewState tracking methods are called. 7. Button's Click event fires, but all controls have already been reset... I think there are two easy ways to avoid this behavior. First is calling DataBind() for particular data-bound controls, not for the entire master page. Second is moving this.DataBind() call to content page's PreRender event handler. I used the latter and it worked |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how can i set content type in jsp page.? | saravanan | Java Server Pages (JSP) | 3 | 09-21-2008 09:25 AM |
| GridView.DataBind not working | rrrajesh84in | ASP and ASP.NET Programming | 1 | 03-21-2008 10:01 PM |
| 'Page' ia an unambiguous reference between 'System.Web.UI.Page' and 'Project1.Page' | poornima | ASP and ASP.NET Programming | 1 | 03-05-2008 03:12 AM |
| detect hour of the day and selects a link, they go to either a day page or night page | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 01-11-2008 02:09 AM |
| problem while loading a page | Jeyaseelansarc | PHP Programming | 3 | 09-27-2007 07:10 AM |