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

[Solved] Detecting when a user selects multiple rows

3 Answers 138 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Richard asked on 26 Jan 2010, 06:03 PM
I have an "OnRowSelected" event that I use to process the state of a bunch of controls on my grid.  The event fires when a user clicks on a row or [ctrl]-clicks on a row.  I noticed that when the user drags to select multiple rows or [shift]-clicks to select multiple rows the "OnRowSelected" event doesn't fire. 

Does anyone know how I can force the OnRowSelected event to fire when the user selects multiple rows as by dragging to select or by holding [shift} and selecting?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 27 Jan 2010, 03:26 PM
Hi Richard,

I just tested this and the OnRowSelected event handler is correctly fired for each selected row, regardless of the method of selection (shift-click, drag to select etc.). Can you specify which version of the controls you are using and elaborate a bit on your Grid settings?

Best wishes,
Pavel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Richard
Top achievements
Rank 2
answered on 27 Jan 2010, 03:42 PM
Hi Pavel.  Thanks for your reply.

Here is the information you requested:

Controls Version: 2009.3.1208.35

Here is my Grid design:  As I had mentioned, the [shift]-select and DragToSelect events don't seem to fire my OnRowSelected event.  I'd appreciate any insight you might have to offer.

        <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" Height="100%" DataSourceID="odsRecords" 
            AllowPaging="true" PagerStyle-AlwaysVisible="true" OnPageIndexChanged="RadGrid1_PageIndexChanged" 
            OnPageSizeChanged="RadGrid1_PageSizeChanged" AllowSorting="true" OnSortCommand="RadGrid1_SortCommand" 
            OnLoad="RadGrid1_Load" OnItemDataBound="RadGrid1_ItemDataBound" AllowMultiRowSelection="true" 
            OnItemCreated="RadGrid1_ItemCreated" OnItemCommand="RadGrid1_ItemCommand" OnColumnCreated="RadGrid1_ColumnCreated">  
            <ItemStyle Wrap="False"></ItemStyle> 
            <HeaderStyle Wrap="True"></HeaderStyle> 
            <PagerStyle Height="28px" Mode="NumericPages" Position="Bottom"></PagerStyle> 
            <FooterStyle Font-Bold="true" /> 
            <MasterTableView DataSourceID="odsRecords" CanRetrieveAllData="False" AllowCustomPaging="true" 
                AllowCustomSorting="true">  
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
                <Columns> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings> 
                <ClientEvents OnRowSelected="GridRowSelected" /> 
                <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
                <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" /> 
                <Resizing AllowColumnResize="True" EnableRealTimeResize="True" ClipCellContentOnResize="false" /> 
            </ClientSettings> 
        </telerik:RadGrid> 
 
0
Pavel
Telerik team
answered on 28 Jan 2010, 11:36 AM
Hi Richard,

I used your settings in a sample test page, but could not reproduce the problem and it seems that the OnRowSelected event is executed as expected. Could you take a look at the attached sample and let me know if you can replicate the problem with it and how to modify the code to make the problem appear?

All the best,
Pavel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Richard
Top achievements
Rank 2
Answers by
Pavel
Telerik team
Richard
Top achievements
Rank 2
Share this question
or