TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Reylin Mathew
NA
347
76k
how to validation usng select only 1 radio btn in inner grid
Jul 3 2018 2:15 AM
i need valdation used for inner grid and also select only one radio button.i got select only one radio button using inner grid.
but validation is not working . i want error msg disply on button click ie (their is no radio button select and button click ) ..plz help me ...thnkx in adv
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head runat=
"server"
>
<title></title>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
></script>
<script language=
"javascript"
type=
"text/javascript"
>
function
singleRbtnSelect(chb) {
//code for select only one radio button
$(chb).closest(
"table"
).find(
"input:radio"
).prop(
"checked"
,
false
).change();
$(chb).prop(
"checked"
,
true
);
}
</script>
<style type=
"text/css"
>
.auto-style1 {
width: 104px;
}
</style>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<div>
<br />
<br />
<asp:Panel ID=
"pnlRegister"
runat=
"server"
>
<center> <table border=
"1"
>
<tr>
<td
class
=
"auto-style1"
>REGISTER NO</td>
<td><asp:TextBox ID=
"txtRegisterNo"
runat=
"server"
></asp:TextBox></td>
<asp:RequiredFieldValidator ID=
"RequiredFieldValidator1"
runat=
"server"
ErrorMessage=
"Enter Your Register Number"
ControlToValidate=
"txtRegisterNo"
></asp:RequiredFieldValidator>
</tr>
<tr><td
class
=
"auto-style1"
> <asp:Button ID=
"btnSubmit"
runat=
"server"
Text=
"Submit"
OnClick=
"btnSubmit_Click1"
Width=
"76px"
/>
<asp:Label ID=
"lblErr"
runat=
"server"
></asp:Label>
</td></tr>
</table></center>
</asp:Panel>
<asp:Panel ID=
"pnlElection"
runat=
"server"
>
<center> <table border=
"1"
>
<tr>
<td>STUDENT NAME:</td>
<td><asp:Label ID=
"lblStdName"
runat=
"server"
></asp:Label></td>
</tr>
<tr>
<td>BATCH NAME:</td>
<td><asp:Label ID=
"lblbatch"
runat=
"server"
></asp:Label></td>
</tr>
</table>
</center>
<br />
<center>
<asp:GridView ID=
"gdPosition"
runat=
"server"
AutoGenerateColumns=
"False"
DataKeyNames=
"Pid"
OnRowDataBound=
"gdPosition_RowDataBound"
style=
"width:300px"
>
<Columns>
<asp:TemplateField >
<ItemTemplate>
<center> <asp:Label ID=
"lblPosition"
runat=
"server"
Text=
'<%# Eval("Vote") %>'
></asp:Label></center>
<asp:HiddenField ID=
"hdfPosition"
runat=
"server"
/>
<asp:GridView ID=
"gdElection"
runat=
"server"
AutoGenerateColumns=
"False"
DataKeyNames=
"Position"
style=
"width:300px"
>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<center><asp:Label ID=
"Label1"
runat=
"server"
Text=
'<%# Eval("StdName") %>'
></asp:Label></center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText=
"Vote For"
>
<ItemTemplate>
<%--<asp:RadioButton ID=
"rbVoteFor"
runat=
"server"
Text=
'<%#Eval("Pid") %>'
/> onclick=
"singleRbtnSelect(this);"
--%>
<center> <asp:RadioButton id=
"rdVote"
runat=
"server"
AutoPostBack=
"true"
OnClick=
"javascript:SelectSingleRadiobutton(this.id)"
GroupName=
"Position"
/></center>
<asp:HiddenField ID=
"hdfVid"
runat=
"server"
Value=
'<%#Eval("Position")%>'
/>
<%--OnCheckedChanged=
"rdVote_CheckedChanged"
--%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</center>
<br />
<center> <asp:Button ID=
"btnVote"
runat=
"server"
Text=
"Vote"
OnClick=
"btnVote_Click"
/>
<asp:Label ID=
"lblError"
runat=
"server"
></asp:Label></center>
</asp:Panel>
</div>
</form>
</body>
</html>
Reply
Answers (
3
)
How to use FindByValue in Asp.Net With CheckboxList
redrected controller view is not displaying