Click here to Skip to main content
15,917,808 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how can i update datagrid which has a checkBox?

best regards
Posted

1 solution

<asp:templatefield headertext="Any Text" xmlns:asp="#unknown">
<itemstyle wrap="false">
<itemtemplate>
<asp:checkbox id="chkStatus" runat="server">
AutoPostBack="true" OnCheckedChanged="chk_OnCheckedChanged"
Checked='<%# Eval("Status") %>'
Text='<%# If(Eval("Status").ToString().Equals("TRUE"), " Returned" , " SOLD" ) %>' />




CODE BEHIND

Private Sub chk_OnCheckedChanged(ByVal sender As Object, ByVal e As EventArgs)

' GET THE CHECKBOX NAME.
Dim chkStatus As CheckBox = DirectCast(sender, CheckBox)
Dim row As GridViewRow = DirectCast(chkStatus.NamingContainer, GridViewRow)

If chkStatus.Checked Then
' WRITE YOU CODE TO SAVE DATA.

End if

End Sub
 
Share this answer
 
v2

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