Active Server Pages Programming (ASP)/radiobutton query
Expert: Srini Nagarajan - 10/13/2011
Questionhey please help me out.. how to get a value from radiobutton in asp. suppose we have 2 radio button and we want to give a if else statement by their clicking like if radio...="sumthing"then.....
thwn what is the syntax for that? like what is written after if ......= like...i hope u understand..i mean what is writtne radio.value or what ? i am new to asp..
thanks in advance
AnswerHi
This is what you need to do
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">
function clickCheck(sval) {
document.getElementById("RBValue").value = sval;
}
</script>
<style type="text/css"></style>
</head>
<body>
<input type=hidden name="RBValue" />
<input type="radio" onClick="clickCheck('expired')" name="Radio1" />Expired<br />
<input type="radio" onClick="clickCheck('notexpired')" name="Radio2" />Not Expired
</body>
</html>
If you get the RBValue in post you should get "expired" or "notexpired", take necessary action which one to display.
Cheers
-Srini