chkRejectAll is in the header, it is not in an item. The list of
items returned only represents the rows in the grid, not the header or
footer.
You need to search in the header to get the reference to check all.
On 8/29/05, iceberg_collision <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I have a Datagrid control in which i have two textboxes one is in
> <ItemTemplate> and another in the <HeaderTemplte> of the same
> <TemplateColumn> as shown below
>
> <asp:TemplateColumn>
> <HeaderStyle CssClass="contentBold"></HeaderStyle>
> <ItemStyle CssClass="content"></ItemStyle>
> <HeaderTemplate>
> <asp:CheckBox ID="chkRejectAll" Runat="server"
> AutoPostBack="True" Checked="False" OnCheckedChanged="RejectFunction"
> Text="Reject All"
> ForeColor="#005900"></asp:CheckBox>
> </HeaderTemplate>
>
> <ItemTemplate>
> <asp:CheckBox Checked="False" ID="chkReject"
> Runat="server" AutoPostBack="True"></asp:CheckBox>
> </ItemTemplate>
> </asp:TemplateColumn>
>
>
> When i call RejectFunction() then i got an error "Object Reference
> not set to instance of an object" pointing towards the Line 9
> Showing chkRejectAll = nothing
> Public Sub RejectFunction(ByVal sender As System.Object, ByVal e As
> System.EventArgs)
>
> Line 1. Dim rowNum As Integer
>
> Line 2. Dim getDataGridItem As DataGridItem
>
> Line 3. Dim chkRejectAll As System.Web.UI.WebControls.CheckBox
>
> Line 4. Dim chkReject As System.Web.UI.WebControls.CheckBox
>
> Line 5. For Each getDataGridItem In grdRequest.Items
>
> Line 6. rowNum += 1
>
> Line 7. chkReject = getDataGridItem.FindControl("chkReject") -------
> ----- This is working fine
>
> Line 8. chkRejectAll = getDataGridItem.FindControl("chkRejectAll") ---
> ---- chkRejectAll = nothing & producing Error.
>
> Line 9. If chkRejectAll.Checked = True Then
>
> chkReject.Checked = True
>
> ElseIf chkRejectAll.Checked = False Then
>
> chkReject.Checked = False
>
> End If
>
> item += 1
>
> Next
>
> End Sub
>
> End Class
>
> Please help me its urgent.
>
> Thanks in Advance
>
> Parvez khan
>
>
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/