PostBack data extreme odity!!

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

Guest

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!
***************************
 
L

Luis Ferrao

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top