界面代碼:
文章來(lái)自 codego.net 請(qǐng)看源代碼:
<form id="form1" runat="server">
<div align="center">
<fieldset >
<table border="0" cellpadding="3" cellspacing="3">
<tr>
<td>
請(qǐng)選擇汽車(chē)類(lèi)型:
</td>
</tr>
<tr>
<td>
<asp:RadioButtonList ID="rbCar" runat="server">
<asp:ListItem Value="1" Text="奔馳汽車(chē)"></asp:ListItem>
<asp:ListItem Value="2" Text="寶馬汽車(chē)"></asp:ListItem>
<asp:ListItem Value="3" Text="奧迪汽車(chē)"></asp:ListItem>
<asp:ListItem Value="4" Text="現(xiàn)代汽車(chē)"></asp:ListItem>
<asp:ListItem Value="5" Text="豐田汽車(chē)"></asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="提交" />
</td>
</tr>
</table>
</fieldset>
<asp:CustomValidator ID="ctvCar" runat="server" Display="Dynamic" ErrorMessage="至少選擇一種車(chē)!"
ForeColor="Red" ClientValidationFunction="rbCar_Validation"></asp:CustomValidator>
</div>
</form>
腳本代碼:
文章來(lái)自 codego.net 請(qǐng)看源代碼:
<head id="Head1" runat="server">
<title>Recipe16</title>
<script type="text/javascript" src="Scripts/jquery-1.4.1-vsdoc.js"></script>
<script type="text/javascript">
function rbCar_Validation(sender, args) {
args.IsValid = ($("#rbCar :radio:checked").length > 0);
}
</script>
</head>
顯示效果:
網(wǎng)頁(yè)標(biāo)題:ASP.NETjQuery實(shí)例16通過(guò)控件CustomValidator驗(yàn)證RadioButtonList
本文URL:http://chinadenli.net/article6/gecjig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信小程序、網(wǎng)站內(nèi)鏈、網(wǎng)站建設(shè)、小程序開(kāi)發(fā)、搜索引擎優(yōu)化、App開(kāi)發(fā)
廣告
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源:
創(chuàng)新互聯(lián)