D
Danielle
Greetings all and thanks in advance for any help you can provide.
I am trying ultimately to get values from a gridview row when a
checkbox on the row is checked. the problem I'm having is that after
ticking the checkbox, the whole page refreshes (expectedly), the
checkbox is unmarked and the response.write message displayed below
never displays. It follows that if I uncomment the lines that try to
capture the value in cell(3) and display that variable nothing is
displayed.
The gridview is standard issue so I've included only the
TemplateField
for the checkbox:
<asp:TemplateField >
<ItemTemplate>
<asp:CheckBox ID="chkContactSelect"
runat="server"
AutoPostBack="true"
OnCheckedChanged="chkContactSelect_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
Here's the code for the sub:
Protected Sub chkContactSelect_CheckedChanged(ByVal sender As
Object, ByVal e As System.EventArgs)
Dim selectedCheckbox As CheckBox
selectedCheckbox = CType(sender, CheckBox)
Dim selectedRow As GridViewRow
selectedRow = CType(selectedCheckbox.NamingContainer,
GridViewRow)
If selectedCheckbox.Checked = True Then
'Text = selectedRow.Cells(3).Text
'Response.Write(Text)
Response.Write("test")
End If
End Sub
Thanks again for any help-
Danielle
I am trying ultimately to get values from a gridview row when a
checkbox on the row is checked. the problem I'm having is that after
ticking the checkbox, the whole page refreshes (expectedly), the
checkbox is unmarked and the response.write message displayed below
never displays. It follows that if I uncomment the lines that try to
capture the value in cell(3) and display that variable nothing is
displayed.
The gridview is standard issue so I've included only the
TemplateField
for the checkbox:
<asp:TemplateField >
<ItemTemplate>
<asp:CheckBox ID="chkContactSelect"
runat="server"
AutoPostBack="true"
OnCheckedChanged="chkContactSelect_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
Here's the code for the sub:
Protected Sub chkContactSelect_CheckedChanged(ByVal sender As
Object, ByVal e As System.EventArgs)
Dim selectedCheckbox As CheckBox
selectedCheckbox = CType(sender, CheckBox)
Dim selectedRow As GridViewRow
selectedRow = CType(selectedCheckbox.NamingContainer,
GridViewRow)
If selectedCheckbox.Checked = True Then
'Text = selectedRow.Cells(3).Text
'Response.Write(Text)
Response.Write("test")
End If
End Sub
Thanks again for any help-
Danielle