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