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
Mayur Gujrathi
405
3.9k
1m
ALLOW ONLY ONE CHECK BOX CHECKED IN GRIDVIEW
May 13 2011 1:21 AM
Dear all i am taking checkbox in gridview as follows
But i want to allow only one checkbox to be checked at rime
means if one is checked then other will be uncehcked automatically
<
asp:TemplateField
>
<
itemtemplate
>
<
asp:CheckBox
ID
="LinkAssignButton"
runat
="server"
CommandName
="Assign"
Text
="Take"
Visible
="true">
</
itemtemplate
>
Reply
Answers (
5
)
0
Zeeshan Azim
745
1.2k
13.6k
Apr 29 2015 7:44 AM
Thanks
Abhimanyu K Vatsa
. Your solution has solved my problems.
0
Mayur Gujrathi
405
3.9k
1m
May 13 2011 4:44 AM
Thanks all
query solved by krishna garad's article as stated by ankit
0
Ankit Nandekar
0
3.9k
2m
May 13 2011 3:19 AM
Mayur read this article it is for radio button u can change it for checkbox also
http://www.c-sharpcorner.com/UploadFile/krishnasarala/6141/
0
Suthish Nair
0
30.5k
7.2m
May 13 2011 2:27 AM
check Our recommended articles section
0
Abhimanyu K Vatsa
0
40.4k
21.5m
May 13 2011 2:26 AM
Use as directed below:
<head>
<script type ="text/javascript">
function CheckOne(obj)
{
var grid = obj.parentNode.parentNode.parentNode;
var inputs = grid.getElementsByTagName("input");
for(var i=0;i<inputs.length;i++)
{
if (inputs[i].type =="checkbox")
{
if(obj.checked && inputs[i] != obj && inputs[i].checked)
{
inputs[i].checked = false;
}
}
}
}
head>
<body>
<asp:GridView ID="GridView1" runat="server" OnRowDataBound ="GridView1_RowDataBound">
<Columns>
<asp:BoundField DataField ="CustomerID" />
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="CheckBox4" runat="server" onclick ="CheckOne(this)" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txtConfirmPassword" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick ="return Validate(this)" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</body>
Dot net Windows project Setup with Data Base
Accessing LoginView (AnonymousTemplate and LoggedInTemplate) from UserControl Codebehind