Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Partial Postback form value problem

In my page_load I am creating a

HiddenField newField= new HiddenField();

and then I am assigning newField.ID = "someid" and Value="0" to it. on a partial postback (triggered by an UpdatePanel) i am then checking

Request.Form["someid"]

in the panel_Load event during the postback. but the request returns null as someid wasn't posted back. (not contained in the Request.Form collection) Why could this be?

Thanks

like image 687
Jimmy Avatar asked Sep 09 '26 21:09

Jimmy


1 Answers

ASP.NET mangles the ID when rendered to the client by default. To access it from the Form collection, try this:

Request.Form[newField.ClientID]
like image 167
Kyle Trauberman Avatar answered Sep 12 '26 11:09

Kyle Trauberman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!