I have a datagrid where first column are checkboxes. I'm trying to add a button in column header, when click will check all checkboxes. I've tried with the following for the onlclick of header button. Could someone point to what i'm doing wrong, Thanx
Sub CheckAll (sender As Object, e as EventArgs)
Dim dgi as DataGridItem
Dim cb as Checkbox
For each dgi In DataGrid1.Items
cb = dgi.FindControl("selectRow")
If cb.checked = False Then
cb.Checked = True
End If
Next
End Sub
Following is the first column of the datagrid:
<asp:TemplateColumn
Visible="True">
<headertemplate>
<input id="chkAllItems" type="button"
onclick="CheckAll"/>
</headertemplate>
<itemtemplate>
<asp:checkbox ID="selectRow" runat="server" />
</itemtemplate>
</asp:TemplateColumn>
When i click on the header button nothing happens, but IE displays a error page on status bar in bottom left. Clicking on it, it states "Error: 'CheckAll' is undefined
Sub CheckAll (sender As Object, e as EventArgs)
Dim dgi as DataGridItem
Dim cb as Checkbox
For each dgi In DataGrid1.Items
cb = dgi.FindControl("selectRow")
If cb.checked = False Then
cb.Checked = True
End If
Next
End Sub
Following is the first column of the datagrid:
<asp:TemplateColumn
Visible="True">
<headertemplate>
<input id="chkAllItems" type="button"
onclick="CheckAll"/>
</headertemplate>
<itemtemplate>
<asp:checkbox ID="selectRow" runat="server" />
</itemtemplate>
</asp:TemplateColumn>
When i click on the header button nothing happens, but IE displays a error page on status bar in bottom left. Clicking on it, it states "Error: 'CheckAll' is undefined