Dear All,
Please help me I am really struggling with accessing the GridClientSelectColumn at server side. My problem is as follows:
I have a RadGrid that has the following structure:
<Telerik:RadGrid ID="rgdPagePromotion"
runat="server"
AutoGenerateColumns="false"
AllowAutomaticInserts="false"
AllowMultiRowSelection="true"
OnItemCreated="rgdPagePromotion_ItemCreated">
<PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView
AutoGenerateColumns="False"
DataKeyNames="Publication">
<Columns>
<Telerik:GridBoundColumn HeaderText="Publication
Code" DataField="Publication"
ReadOnly="true"
Visible="true"
UniqueName="Publication
Code" >
</Telerik:GridBoundColumn>
<Telerik:GridClientSelectColumn
HeaderText="Promote"
DataTextField="Promote" UniqueName="Promote" >
</Telerik:GridClientSelectColumn>
<Telerik:GridImageColumn HeaderText="Status"
ImageUrl=""
AlternateText="Not
Yet started to Promote">
</Telerik:GridImageColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="false"
>
<Selecting AllowRowSelect="True"
UseClientSelectColumnOnly="true"></Selecting>
</ClientSettings>
</Telerik:RadGrid>
As you can see from above I am using a GridClientSelectColumn for having a checkbox column, with a header checkbox to select all checkboxes, in the radgrid. Now the problem is when the Radgrid is initially databinded on server side I wish to set some checkboxes. Then on the client side the user may make select/unselect the checkboxes. There is a separate button on the page on click of which, on postback, on server side again I need to access this GridClientSelectColumn to see which checkboxes are selected.
I have read the article on
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectrowwithcheckbox/defaultcs.aspx
which describes something similar but they are using asp:checkboxes which I somehow do not wish to use due to some reason.
On server side on page load immediately after
rgdPagePromotion.DataSource = dt;
rgdPagePromotion.DataBind();
I did try to access the column by the following code but it didn't work:
foreach (GridDataItem item in rgdPagePromotion.MasterTableView.Items)
{
CheckBox cb = (CheckBox)item["Promote"].Controls[0];
cb.Checked = true;
}
The code shows no error but on client side the checkboxes are not checked.
Could someone please help me with some code examples about how to access the gridClientSelectColumn checkboxes at server side during initial page load and then again on button click postback.
Waiting eagerly for a response.
Thanks and Regards,
Gaurav