Hello,
I am using a RadGrid and I am binding an Arraylist of type "myClass" (name property, id Property and several boolean properties). I am using this arrayList as my datasource for the grid and I am using checkbox columns for the boolean properties.
The issue I am having is that when I check a checkbox it does not update the object it is bound to. Please help. Here is my grid:
This is my datasource:
What am I missing?
Thanks
I am using a RadGrid and I am binding an Arraylist of type "myClass" (name property, id Property and several boolean properties). I am using this arrayList as my datasource for the grid and I am using checkbox columns for the boolean properties.
public interface IMyClass {
int EntityID{get; set; }
string Name { get; set; } bool IsPrivateReader { get; set; } bool CanShare { get; set; } }The issue I am having is that when I check a checkbox it does not update the object it is bound to. Please help. Here is my grid:
<telerik:RadGrid ID="dg" runat="server" AllowSorting="True" AllowAutomaticUpdates="True" Skin="WebBlue" EnableAJAX="true" EnableOutsideScripts="true" GridLines="None"> <ClientSettings> <Selecting CellSelectionMode="None" /> </ClientSettings> <MasterTableView AllowAutomaticDeletes="true" AutoGenerateColumns="False" CommandItemDisplay="None" DataKeyNames="EntityID" Width="100%"> <CommandItemSettings ExportToPdfText="Export to PDF" /> <RowIndicatorColumn> <HeaderStyle Width="20px" /> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px" /> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="EntityID" HeaderStyle-HorizontalAlign="Center" HeaderText="Entity ID" ItemStyle-HorizontalAlign="Left" SortExpression="EntityID"> <HeaderStyle HorizontalAlign="Center" /> <ItemStyle HorizontalAlign="Left" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Name" HeaderStyle-HorizontalAlign="Center" HeaderText="Name" ItemStyle-HorizontalAlign="Left" SortExpression="Name"> <HeaderStyle HorizontalAlign="Center" /> <ItemStyle HorizontalAlign="Left" /> </telerik:GridBoundColumn> <telerik:GridTemplateColumn headertext="Private Reader" uniquename="PrivateReaderColumn"> <itemtemplate> <asp:CheckBox ID="cbxPrivateReader" runat="server" checked='<%# Eval("IsPrivateReader") %>' /> </itemtemplate> <edititemtemplate> <asp:CheckBox ID="cbxPrivateReader" runat="server" checked='<%# Bind("IsPrivateReader") %>' /> </edititemtemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn headertext="Share" uniquename="SharedColumn"> <itemtemplate> <asp:CheckBox ID="cbxShare" runat="server" checked='<%# Eval("CanShare") %>' /> </itemtemplate> <edititemtemplate> <asp:CheckBox ID="cbxShare" runat="server" checked='<%# Bind("CanShare") %>' /> </edititemtemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn AllowFiltering="true" HeaderText=" " Reorderable="true" ShowSortIcon="true" SortExpression="Name"> <ItemTemplate> <asp:ImageButton ID="btnDelete" runat="server" CausesValidation="False" CommandName="DeleteSelected" ImageUrl="~/Images/Delete.gif" OnClientClick="return GetUserConfirmForItemDelete(event);" ToolTip="Delete Record" /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"> </EditColumn> </EditFormSettings> </MasterTableView> <FilterMenu EnableTheming="True" Skin="WebBlue"> <CollapseAnimation Duration="200" Type="OutQuint" /> </FilterMenu> </telerik:RadGrid>This is my datasource:
protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) { ViewState["DataSource"] = new ArrayList(); SetInitialJavaScriptFunctions(); } } private ArrayList DataSource { get { return (ArrayList)ViewState["DataSource"]; }
private
void BindDataGrid(string strSortExpression = "", SortDirection eSortDirection = SortDirection.Ascending)
{
dg.DataSource = DataSource;
dg.DataBind();
}
What am I missing?
Thanks