PostBack data extreme odity!!

  • Thread starter Thread starter Luis Ferrao
  • Start date Start date
L

Luis Ferrao

Hi,

I've had the opportunity to witness an very strange thing during the
LoadPostData() of one of my forms.

The problem is that only some of the fields in the form are filled with
the PostBack data. Theese fields are the ones that are not linked to a
"RequiredFieldValidator".

All the fields are encapsulated within UserControl elements. I use this
UserControl elements in other pages and they work just fine. The only
difference is that in other web forms theese controls are created and
added in the code behind while in this forms they're added manually in
the designer.

The save button just posts back, no other operations involved. All
fields should be repopulated with the postback data but the required
ones aren't.
 
Not sure this will help, but it will point you in the right direction.

Behind the scenes, a lot goes on to get form controls filled. In your
scenario, you are doing two things that reduce the chance of success. The
first, using a user control, is quite common, and should not, by itself,
cause any issues, unless you have the control set up incorrectly. The second,
dynamically adding controls, however, is likely to blow up. The reason is
simple: You are stepping outside of the declarative model of the framework.

What this means is you will have to control state of the controls by
grabbing the information and making sure it is placed and retrieved from
ViewState.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
That's what i thought as well but from what i've read recently the last
part of your reply is not correct.

The repopulation of the form fields doesn't use the View State. It uses
something else called "PostBack Data". This is according to this article
from MSDN:

http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnasp
p/html/viewstate.asp#viewstate_topic2

But for the rest of the message you might actualy have pointed me in the
right direction, i'm goint to look into it.

Thank you,

Luis
 
Back
Top