IT Community - Software Programming, Web Development and Technical Support

problem when I use this.DataBind() in content page..?

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....


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-22-2007, 11:14 PM
Archer Archer is offline
D-Web Programmer
 
Join Date: Jun 2007
Posts: 52
Archer is on a distinguished road
Question problem when I use this.DataBind() in content page..?

Work around for Master page problem when we use this.DataBind() in content page.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-22-2007, 11:30 PM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Re: problem when I use this.DataBind() in content page..?

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 09:52 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0