0
我GOOGLE和搜索全部通過JavaScript獲取asp單選按鈕值的值,但我一直未定義。我尋找幾乎所有的方式來獲得rb值,但肯定爲什麼我不明確。任何幫助表示讚賞。獲取asp單選按鈕值通過JavaScript
當單擊對話框窗口確定按鈕時調用clientfunction()。
這是我的代碼。
<div style="width: 480px;">
<MyUserControl:FormItem ID="FormItem1" runat="server" Label="Outcome" IsRequired="true">
<Content>
<div>
<asp:RadioButton ID="rbThisButton" GroupName="outcome" Text="This radio button" runat="server" Checked="<%# model.thisbutton %>" />
</div>
</Content>
</MyUserControl:FormItem>
<script type="text/javascript">
function clientFunction() {
debugger;
$('select[id$=rbThisButton]').each(function() {
var val = this.value;
if (val == 'All') { flag = true; }
});
var test = $('#<%=rbThisButton.ClientID %> input[type=radio]:checked').val();
var selectedVal = $("[id$='rbThisButton']").find(":checked").val();
var selectedvalue = $('#<%= rbThisButton.ClientID %> input:checked').val()
debugger;
var rates = document.getElementById('rbThisButton');
}
</script>
</asp:Content>
什麼時候調用'clientFunction'? –
ClientFunction在點擊'OK'按鈕時被調用。 – John
'asp:radiobutton'生成一個'',所以你爲什麼要嘗試一個選擇器:'select [id $ = rbThisButton]'而不是'input [type = radio] [id * = rbThisButton ]' –