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

Issue with rad GridClientSelectColumn Checkboxes

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ray
Top achievements
Rank 1
Ray asked on 04 May 2016, 04:53 PM

Hi Folks,

I having an issue when i set some rows ClientSelectColumn checkboxes to checked server side, but when i access them client side in the RowCreated event I get the wrong answer. 

function RowCreated(sender, args) {
                    
 
        var ID = args.getDataKeyValue("InstrumentID");
        if (selected[ID]) {
           args.get_gridDataItem().set_selected(true);
           ExpandGroups(args);
         }
         if (args.get_gridDataItem().get_selected()) { //Always False!
             RowSelected(sender, args);
         }
         else
             RowDeselected(sender, args);
      
 }

 

The Server side is setting the checkbox like:

            //load the Grid
            foreach (GridDataItem gdi in _GrdFunds.MasterTableView.Items)
            {
                if (gdi["selectColumn"] != null)
                {
                    CheckBox gdiCheckbox = (CheckBox)gdi["selectColumn"].Controls[0];
                    if (isInstrumentSaved(gdi["InstrumentId"].Text, report))
                    {
                        gdiCheckbox.Checked = true;
                        gdi.Selected = true;


                    }
                    else
                    {
                        gdiCheckbox.Checked = false;
                        gdi.Selected = false;

                    }
                }
            }

 

 

And Grid is defined as:


                        <telerik:RadGrid ID="_GrdFunds"
                            runat="server"
                            AllowMultiRowSelection="True"
                            AllowFilteringByColumn="True"
                            CellSpacing="0"
                            GridLines="None"
                            ShowGroupPanel="True"
                            Skin="Metro"
                            DataSourceID="FundsList"
                            Style="margin-top: 5px;"
                            OnColumnCreated="_GrdFunds_ColumnCreated"
                            OnItemCreated="_GrdFunds_ItemCreated"
                            OnItemDataBound="_GrdFunds_ItemDataBound"
                            OnGroupsChanging="_GrdFunds_GroupsChanging" AllowSorting="True" Font-Size="X-Small" Height="100%">
                            <GroupingSettings CaseSensitive="False" ShowUnGroupButton="True" />
                            <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
                                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                <Selecting AllowRowSelect="True"></Selecting>

                                <Resizing AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowResizeToFit="True" ShowRowIndicatorColumn="True"></Resizing>
                                <ClientEvents OnRowCreated="RowCreated" OnRowDeselected="RowDeselected" OnRowSelected="RowSelected" OnGridCreated="GridCreated"
                                    OnColumnCreated="_GrdFunds_OnColumnCreated" OnMasterTableViewCreated="_GrdFunds_OnMasterTableViewCreated" />
                                <Animation AllowColumnReorderAnimation="True" />
                            </ClientSettings>

                            <MasterTableView AutoGenerateColumns="True" ClientDataKeyNames="InstrumentID" DataKeyNames="InstrumentID" DataSourceID="FundsList" GroupLoadMode="Client" GroupsDefaultExpanded="False" TableLayout="Fixed">
                                <CommandItemSettings ExportToPdfText="Export to PDF" />
                                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="False">
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridClientSelectColumn DataType="System.Boolean" Reorderable="False" Resizable="False" UniqueName="selectColumn">
                                        <HeaderStyle Width="36px" />
                                        <ItemStyle Width="36px" />
                                    </telerik:GridClientSelectColumn>
                                </Columns>
                                <EditFormSettings>
                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                    </EditColumn>
                                </EditFormSettings>

                            </MasterTableView>

                            <FilterMenu EnableImageSprites="False"></FilterMenu>
                        </telerik:RadGrid>

 

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 09 May 2016, 12:14 PM
Hello Ray,

Please examine the RadGridGetAllSelectedItemsImproved.zip sample provided in the following post and see the implementation demonstrated there:
http://www.telerik.com/support/code-library/get-selected-items-through-all-pages#1eTU8nr-GUG8zfGgOGbIcA


Regards,
Eyup
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Ray
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or