Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Right Click Multiselects Rows

Not answered Right Click Multiselects Rows

Feed from this thread
  • dave avatar

    Posted on Feb 7, 2012 (permalink)

    I am using the version 2011.3.1305.35 of the RadGrid and experiencing some strange behavior when the grid is right clicked. Occasionally when a user right clicks the gird to bring up a context menu the row that was right clicked will be selected in addition to any rows that were previously selected. The other times it just displays the context menu without selecting the rows. It seems to be intermittent and I cannot consistently reproduce results. I do not want the additional rows to be selected. Is there any way to trap how a row became selected? The domEvent property of the onrowselecting event args does not look like it has what I need.

     
    Here is how i have the grid configured and the code that displays the context menu:

    <telerik:RadGrid ID="tGrid" runat="server" AllowPaging="True" AllowCustomPaging="true" PageSize="500"
                    AllowSorting="True" AutoGenerateColumns="False" CellSpacing="0"
                    OnNeedDataSource="tGrid_NeedDataSource" AllowMultiRowSelection="true"
     OnItemCreated="tGrid_ItemCreated" >
                    <PagerStyle AlwaysVisible="True" Position="Top"/>
                    
                    <MasterTableView Width="100%" DataKeyNames="schedID" ClientDataKeyNames="schedID">
                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>                   
                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                        <Columns>
                            ...
                        </Columns>
     
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                    <ClientSettings EnableRowHoverStyle="true">
                        <Selecting AllowRowSelect="True" />
                        <ClientEvents OnGridCreated="GridCreated"
                                      OnRowContextMenu="RowContextMenu" OnRowDblClick="tGrid_RowDblClick" />
                        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                    </ClientSettings>                          
                    <FilterMenu EnableImageSprites="false"></FilterMenu>               
                </telerik:RadGrid>

     

    function RowContextMenu(sender, eventArgs)
    {
        var contextmenu = $find("<%=DisplayContextMenu.ClientID %>");
         
        //get_domEvent returns a reference to the DOM event that caused the clicking
        var domEvent = eventArgs.get_domEvent();
     
        //If we're in an input field or a link, just ignore this request for a context menu
        if (domEvent.target.tagName == "INPUT" || domEvent.target.tagName == "A")
            return;
                       
        contextmenu.show(domEvent);
         
        domEvent.cancelBubble = true;
        domEvent.returnValue = false;
     
        if (domEvent.stopPropagation)
        {
            domEvent.stopPropagation();
            domEvent.preventDefault();
        }
     
        if(sender.get_id() == "<%= tGrid.ClientID %>")
            rightClickedRowId = eventArgs.getDataKeyValue("schedID")                
    }


    Thanks Dave

    Reply

  • Tsvetoslav Tsvetoslav admin's avatar

    Posted on Feb 9, 2012 (permalink)

    Hi Dave,

    Are you using the drag-to-select feature of the grid? Does EnableDragToSelect=false make any difference? Do let us know if it is a feasible work-around for you.

    Regards, Tsvetoslav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

  • dave avatar

    Posted on Feb 9, 2012 (permalink)

    Yes, that does seem to help. However, when I use the shift key to select multiple rows the contents on the page gets selected as well. It does not look as nice as it did when the EnableDragToSelect was set to true. Is there any way to prevent the page selection?

    Thanks,
    Dave

    Reply

  • Tsvetoslav Tsvetoslav admin's avatar

    Posted on Feb 10, 2012 (permalink)

    Hello Dave,

    Our development team will be looking into a possible fix for the issue and we will be getting back to you with further information. 

    Regards,
    Tsvetoslav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

  • Tsvetoslav Tsvetoslav admin's avatar

    Posted on Feb 10, 2012 (permalink)

    Hello Dave,

    Our development team will be looking into a possible fix for the issue and we will be getting back to you with further information. 

    Regards,
    Tsvetoslav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

  • Tsvetoslav Tsvetoslav admin's avatar

    Posted on Feb 23, 2012 (permalink)

    Hi Dave,

    The issue has just been fixed and the fix will be available in the next latest internal build of the controls that's coming up on Tuesday next week. Thanks for turning our attention to this problem. I have updated your telerik points.


    All the best, Tsvetoslav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Right Click Multiselects Rows
Related resources for "Right Click Multiselects Rows"

ASP.NET Grid Features  |  Documentation  |  Demos  |  Step-by-step Tutorial  ]