Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
XML
<asp:TemplateField>
<itemtemplate>
<asp:CheckBox ID="LinkAssignButton" runat="server"
CommandName="Assign"
Text="Take" Visible="true">
</itemtemplate>
Posted

 
Share this answer
 
<asp:checkbox name='%#Eval("someautoincname")%' />

In this way you can assign unique name to each checkbox after then implement javascript.

if u r not getting feel free to ask.
 
Share this answer
 
v2
Comments
Mayur Gujrathiii 13-May-11 2:02am    
i am not getting
i have done as follows on checked change event
and i have also calling one javascript on checked changed

<asp:TemplateField HeaderText="SELECT">
<itemtemplate>
<asp:CheckBox ID="check" runat="server" OnCheckedChanged="check_CheckedChanged" ToolTip ="javascript:ViewSIGN();" AutoPostBack="true" Visible="true">





Protected Sub check_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)

myds = DirectCast(ViewState("dsdata"), DataSet)

Dim chkbox As CheckBox = CType(sender, CheckBox)
Dim Grow As GridViewRow = CType(chkbox.NamingContainer, GridViewRow)

btnauthorise.Enabled = True
btnreject.Enabled = True

If (chkbox.Checked = True) Then

btnauthorise.Enabled = True
btnreject.Enabled = True
strCureentRowIndex = Grow.RowIndex
hdrowno.Value = strCureentRowIndex
reqslipno = myds.Tables(0).Rows(strCureentRowIndex)(1).ToString()
Boid = myds.Tables(0).Rows(strCureentRowIndex)(3).ToString()
imag.Visible = True
Image2.Visible = True
imag.ImageUrl = myds.Tables(0).Rows(strCureentRowIndex).Item("imagepath")
Image2.ImageUrl = hdimage2.Value
End If

End Sub


and

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900