Interactive Grid

2 posts, 0 answers
  1. Nathan J Pledger
    Nathan J Pledger avatar
    95 posts
    Member since:
    Apr 2006

    Posted 15 Jun 2009 Link to this post


    I would like a grid to have a checkbox column which is readily "checkable" by the user and a fixed (bound) textual column to the right of this column. Much like a CheckBoxLst control.

    I have the following RadGrid:

    <telerik:RadGrid ID="radGridGroups" runat="server" 
                                                        <ClientSettings AllowColumnHide="false" AllowColumnsReorder="false" AllowRowHide="false" AllowRowsDragDrop="false" EnableAlternatingItems="false" EnablePostBackOnRowClick="false" EnableRowHoverStyle="false"
                                                            <Resizing AllowColumnResize="false" AllowRowResize="false" /> 
                                                            <Scrolling AllowScroll="true" EnableVirtualScrollPaging="true" /> 
                                                            <Selecting AllowRowSelect="false" EnableDragToSelectRows="false" /> 
                                                        <MasterTableView GridLines="None" NoMasterRecordsText="There are no Groups defined" DataKeyNames="DataGroupID"
                                                                <telerik:GridCheckBoxColumn DataField="IsEnabled" DataType="System.Boolean" HeaderText="In Group" Resizable="false" Reorderable="false" UniqueName="IsEnabled" ReadOnly="false" > 
                                                                    <ItemStyle Width="20" /> 
                                                                <telerik:GridBoundColumn DataField="DataGroupName" DataType="System.String" HeaderText="Group Name" Resizable="false" Reorderable="false" ReadOnly="true" UniqueName="DataGroupName"
                                                                    <ItemStyle Width="320" /> 
                                                            <RowIndicatorColumn Display="false" />                                                       

    I bind this using the LINQ:

    private void PopulateDataGroupsGrid(bool rebind) 
                var query = from dg in _dataGroups 
                            join dgi in _originalDataGroupItems on dg.ID equals dgi.ParentDataGroup.ID into sr 
                            from x in sr.DefaultIfEmpty() 
                            select new { DataGroupID=dg.ID, IsEnabled = x != null, DataGroupName=dg.Name }; 
                radGridGroups.DataSource = query; 
                if (rebind) radGridGroups.DataBind(); 

    Which is called by the NeedDataSource event handler:

            void radGridGroups_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 

    The problem is that this produces a static grid. I can't tick/untick the items in the grid. I don't want to use a Row Selection mechanism, and I will need to add further columns in the future. 

    I would dearly like to have the users just "tick"/"untick" as they see fit, hit the "Save" button on my form and for me to then apply the changes to the DB.

    How can I best achieve this?

  2. Yavor
    Yavor avatar
    11 posts

    Posted 17 Jun 2009 Link to this post

    Hi Nathan,

    The checkbox column is not editable in standard mode.
    One possible option in this case would be to have all items in edit mode. Then, you can check the items as required and update all the items in one go.
    I hope this suggestion helps.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top