views:

106

answers:

2

ASP.NET, C#, Javascript

I have an unknown number of results returning from an sql querey.

I then make changes to their values with javascript and set a value on a hidden input (generated programatically on page_init).

My question is: what's the best way to access the hidden input variables values in the C# code behind file.

+4  A: 

Use the Request.Form property, like this:

var value = Request.Form["MyHiddenInputName"];

If you don't know how many items there are, you can loop through its Keys property.

SLaks
A: 

You will be able to examine the Request collection during a post back to get the value directly like traditional ASP if all else fails.

If you are adding the control server side, which it sounds like you are, you'll actually be able to use the instance of the control you create in Init to get its value (after Init completes).

cfeduke