After getting the value, how can I bring the var to ASP.net server side so I can use it in server side?
function btnSelect_OnClick() {
var PCType;
if (document.getElementById('r1').checked) {
PCType = document.getElementById('r1').value);
}
}
If you don't want to use an AJAX solution, consider storing the value in a HiddenField
.
JavaScript
function btnSelect_OnClick() {
var PCType = "";
if (document.getElementById('r1').checked) {
PCType = document.getElementById('r1').value);
}
document.getElementById('hfPCType').value = PCType;
}
ASP.Net
<asp:HiddenField runat="server" id="hfPCType" ClientIDMode="static" />
C#
string PCType = hfPCType.Value;
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.