My application uses master pages, I have a Prometheus RadGrid on my content page along with an asp:Image control that, when you mouseover it, displays a RadContextMenu with options for exporting grid data (Excel, PDF, etc.). I have the RadContextMenu controlling the grid via RadAjaxManagerProxy:
<telerik:AjaxSetting AjaxControlID="RadContextMenuExport">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="radgRoles" LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="RadContextMenuExport" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
And I am handling the "AjaxRequestStart" event of the master page RadAjaxManager with the following script (as found on a telerik code library project):
function OnAjaxManagerRequestStart(ajaxManager, eventArgs)
{
var arg = eventArgs.EventTarget;
// If the object initiating this request was an "Export" button (for exporting RadGrid data)
// cancel the Ajax request so a normal postback occurs. This is required for RadGrid
// export functionality to work.
if (arg.substring(arg.length - 6) == 'Export') eventArgs.EnableAjax = false;
}
It works just fine but, after doing an export, the next time I click to expand/collapse a grouping in my grid, the OnAjaxManagerRequestStart function continues to recognize the control requesting the AjaxRequest as the RadContextMenu. As soon as I sort on the grid (or any other action), expand/collapse functionality returns to normal. Any ideas?
| public string SelectedId |
| { |
| get |
| { |
| int result; |
| if( !int.TryParse(_RadGroupBox.SelectedValue, out result)) |
| { |
| result = 0; |
| } |
| return result.ToString(); |
| } |
| set |
| { |
| // Place is just a custom object with a name and id. |
| Place place = new Place(Convert.ToInt32(value)); |
| place.PlaceId = Convert.ToInt32(value); |
| RadComboBoxItemData itemData = new RadComboBoxItemData(); |
| itemData.Value = value; |
| itemData.Text = GroupFormatter.GetLongDisplayName(place); |
| RadComboBoxItem item = new RadComboBoxItem(itemData.Text, itemData.Value); |
| item.Selected = true; |
| _RadGroupBox.Items.Add(item); |
| _RadGroupBox.SelectedIndex = 0; |
| } |
| } |
| get |
| { |
| int result; |
| if( !int.TryParse(_RadGroupBox.SelectedValue, out result)) |
| { |
| result = 0; |
| } |
| return result.ToString(); |
| } |
