UploadValues doesn't load server controls

  • Thread starter Thread starter .Net Developer
  • Start date Start date
N

.Net Developer

I'm using the UploadValues method of the WebClient to post
values to one of my .aspx pages. My expectation is that
the page will recognize the posted values and populate my
page controls, but it doesn't.

For example, I have a textbox server control whose id
is "FirstName". When I post a name/value pair
("FirstName", "Bob") from my WebClient class and debug the
corresponding .aspx, I can get to the "FirstName" value
through the request.form collection, but not via the text
property of the "FirstName" textbox.

Shouldn't the framework match-up the posted values with
their cooresping controls? Or, does it not work because
the framework doesn't treat the request as a postback?

Thanks.
 
your WebClient code needs to do a "GET" first to get a vaild viewstate
(which will be a hidden field in the html), that you postback as a value.

-- bruce (sqlwork.com)


because you are not posting back the viewst
 
Back
Top