Read Request.Form Variables in ASP.NET?

  • Thread starter Thread starter Brian Ciarcia
  • Start date Start date
B

Brian Ciarcia

I have a form that uses panels to show and hide a group of questions.
These questions are plain html radio buttons... I need to be able to
submit the form and get the values.. Everything I try doesn't work..
once I move the radio buttons outside the panels, it works fine. Anyone
have any suggestions??
 
I have a form that uses panels to show and hide a group of questions.
These questions are plain html radio buttons... I need to be able to
submit the form and get the values.. Everything I try doesn't work..
once I move the radio buttons outside the panels, it works fine. Anyone
have any suggestions??

It's because .NET 'renames' the ids of controls in the resulting HTML. If
a control is inside of a parent-container control, .NET concatenates the
two ids, etc. So the id you use in the aspx is not necessarily the same
as what's in the HTML (and therefore the POSTed data).

I believe the property you want is Control.ClientID...the other one that's
similar is Control.UniqueID....
 
I tried looping through the request.form.. I only get the button, which
is outside the panels... This is the code I am using to loop..

---------------------------------------------------------

Dim counter As Integer
Dim arr() As String
Dim coll As NameValueCollection

coll = Request.Form

arr = coll.AllKeys

For counter = 0 To arr.GetUpperBound(0)
Response.Write("Form: " & arr(counter) & "<br>")
Next counter
 
I need to use the two radio buttons for each question. (i.e. yes and no
radio buttons)... These questions will eventually be grabbed from a
database, so that is another reason, i couldn't server controls..
Unless I am totally confused..
 
Back
Top