验证单选按钮 [英] Validation for radio buttons
问题描述
我是使用c#的asp.net的初学者. .
在我的项目中,我使用了一个带有Input(Radio)的gridview控件.如果我选择了1个单选按钮,则单击选择"(它是一个按钮).然后,所选的单选按钮详细信息将显示在以下文本框中.然后我可以对其进行修改并将其存储..
我的问题是假设用户如果不选择单选按钮,则直接单击选择按钮,而不在网格视图中选择单选按钮,就会发生错误.
然后我的问题是如何为该按钮单击设置验证.
请帮助我..我不知道..是对还是错..
由
玫瑰色..
[edit]主题,仅标记-OriginalGriff [/edit]
I am the beginner of asp.net using c# . .
In my project i used one gridview control with Input(Radio). If I select 1 radio then click select(Its a button).then selected radio button details are display the following textboxes. then i can modify it and store it..
My problem is suppose the user if doesn''t choose the radio button, he directly click the select button without choosing a radio button in grid view the error will be occur .
Then my qustion is how to set validation for that button click.
Plz help me.. i don''t know.. dis s correct or wrong..
By
Rosy..
[edit]Subject, tags only - OriginalGriff[/edit]
推荐答案
将其中之一设置为默认选中的单选按钮
set one of them as by default selected radio button
嗨
请参考
http://www.esqsoft.com/javascript/javascript-example- how-to-validate-radio-buttons.htm [ ^ ]
hi
refer this
http://www.esqsoft.com/javascript/javascript-example-how-to-validate-radio-buttons.htm[^]
您可以使用javascript函数检查
You can use javascript function to check
function GetRadioButtonValue(id)
{
var radio = document.getElementsByName(id);
for (var j = 0; j < radio.length; j++)
{
if (radio[j].checked)
alert(radio[j].value);
}
}
这篇关于验证单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!