1 2 How d...">Geek Answers HandbookGet selected ASP.NET input type buttonI 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?+4html radio-button asp.netHannoun yassir Oct 6 '09 at 15:28source share2 answersInputs 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"] +9Kobi Oct 6 '09 at 15:35source shareIf you use runat = "server", it may happen that the name attribute changes on the client, so you get null as the value.0ivan Dec 28 '09 at 15:22source shareMore articles:Sorting a string collection in Python using various locale settings - pythonIBM MQ Message Listener - javaSearch only matching words at the beginning - searchCreating the Edit My Element page in Java servers using Facelets - javaWhat specifications, documents, analysis do you get from your bosses when you start a project? - analysisTimezone support in ColdFusion? - timezoneJQuery: select html element inclusive? - jqueryCan the data in the UDP packet be considered correct at the application level? - unix5 separate databases or 5 tables in 1 database? - mysqlWhat do I know about working with ADO.Net Data Services? (QUESTIONS AND ANSWERS) - c #All Articles
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?
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:
group1
Request.Form["group1"]
If you use runat = "server", it may happen that the name attribute changes on the client, so you get null as the value.