This is a migrated thread and some comments may be shown as answers.

RadGrid CheckBox ia always false

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 11 Jul 2012, 07:06 PM
This one is driving me insane and is probably a simple fix.  All i'm trying to do is foreach(griditem) and if that control is checked process it on a button click, but all the checkboxes are false. 

The GridView is created using AutoGenerateColumns, however in the aspx I push a checkbox column in before hand. Everything looks great just this always false is kiling me.


 foreach (GridDataItem gdItem in RoleNamePageNameAddGrid.MasterTableView.Items)
            {
                CheckBox chk = (CheckBox)gdItem.FindControl("CheckBoxAdd") as CheckBox;
                if(chk.Checked == true)
                {
                }


            }

<telerik:RadGrid ID="RoleNamePageNameAddGrid" runat="server">
        <MasterTableView DataKeyNames="PageDefn">
            <Columns>
                <telerik:GridTemplateColumn HeaderText="Update">
                    <ItemTemplate>
                        <asp:CheckBox ID="CheckBoxAdd" runat="server" AutoPostBack="false" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    <telerik:RadButton ID="AddPageRoleAttachmentButton" runat="server" Text="Add" OnClick="AddPageRoleAttachmentButton_Click">
    </telerik:RadButton>

1 Answer, 1 is accepted

Sort by
0
Joshua
Top achievements
Rank 1
answered on 11 Jul 2012, 07:09 PM
Go figure as soon as I post something I find the answer

On PageLoad you have to !Page.ISPostBack

 

http://forums.asp.net/post/1786184.aspx

Tags
Grid
Asked by
Joshua
Top achievements
Rank 1
Answers by
Joshua
Top achievements
Rank 1
Share this question
or