1 2 How d...">

Get selected ASP.NET input type button

I have two switches:

<input type="radio" name="group1" />1 <input type="radio" name="group1" />2 

How do I know which one is selected when submitting the form?

+4
source share
2 answers

Inputs must have values:

 <input type="radio" name="group1" value="1" />1 <input type="radio" name="group1" value="2" />2 

Then the value will be published in the name group1 . On Asp.net you can get it using:

 Request.Form["group1"] 
+9
source

If you use runat = "server", it may happen that the name attribute changes on the client, so you get null as the value.

0
source

All Articles