简体   繁体   English

ASP.NET Webform:获取代码隐藏上选定复选框的值

[英]ASP.NET Webform: Getting values of selected checkbox on codebehind

I have added a check box to the Jquery Datatable, can you please advise how can i get value of the selected checkbox on button click code behind.I am using Asp.Net Webforms .我在 Jquery 数据表check box添加了一个check box ,您能否告知我如何在button click代码后面获取所选checkbox值。我正在使用Asp.Net Webforms Thanks.谢谢。

<input type='checkbox' value="xxx">

I expect to access the value of selected checkbox on codebehind我希望访问代码codebehind上选定checkbox的值

By using runat server you can easily get value of input tag.通过使用 runat 服务器,您可以轻松获取输入标签的值。

<input type='checkbox' id="testID" value="xxx" runat="server">

Code Behind背后的代码

string inputvalue = testID.Value;

Or you can use或者你可以使用

<input type='checkbox' id="testID" value="xxx">

Code Behind背后的代码

string inputvalue = Request.Form["testID"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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