Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the selected input type radio button ASP.NET

I have two radio buttons:

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

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

like image 975
Hannoun Yassir Avatar asked Jan 24 '23 03:01

Hannoun Yassir


1 Answers

The inputs should have values:

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

Then, the value will be posted on the name group1. On Asp.net you can get it using:

Request.Form["group1"]
like image 174
Kobi Avatar answered Jan 31 '23 07:01

Kobi