简体   繁体   中英

How to get HTML% Radio button value in C#?

I want to get the selected radio button value in C#. I used the following code for radio button.

<input id="C" type="radio" name ="language" value ="C" /> <label for = "C">C</label> <br>
<input id="C++" type="radio" name ="language" value ="C++" /> <label for = "C++">C++</label> <br>
<input id="C#" type="radio" name ="language" value ="C#" /> <label for = "C#">C#</label> <br>
<input id="VB" type="radio" name ="language" value ="VB" /> <label for = "VB">VB</label> <br>

Now i want to get the selected radio button value in C#.

Request.Form(“ language”)应该可以工作

Try this…

if (Request.Form["language"] != null)
{
     string value = Request.Form["language"].ToString();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM