Hente valgt værdi i en RadioButtonList med javascript
HejsaJeg har en enkelt side med en RadioButtonList hvis indhold bliver dannet i min codebehind file. Yderliger har jeg en knap som med javascript skal vise DataValueField for den valgte:
Her er min kode:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GetSBA.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Select SBA</title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function transferSelectedSBA(){
alert(document.form1.???????????????????????????);
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<asp:Panel ID="Panel1" runat="server" BackColor="#EFF3FF" BorderColor="#8C8E94" BorderStyle="Solid"
BorderWidth="1px" Height="300px" ScrollBars="Auto" Width="260px">
<asp:RadioButtonList ID="rblSBA" runat="server" DataTextField="SBA" DataValueField="key">
</asp:RadioButtonList></asp:Panel>
<br />
<input onclick="transferSelectedSBA()" id="Select_button" type="button" value="Select" />
<input onclick="window.close()" id="cancel_button" type="button" value="Cancel" /></div>
</form>
</body>
</html>
Hvordan viser jeg den valgte værdi?