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

Refresh Rad Grid's CONTEXT MENU on RadWindow Close

2 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 08 Nov 2011, 06:27 PM
Hi All,

I am using the technique show in this forum to refresh a RadGrid on a RadWindow close:

http://www.telerik.com/community/forums/aspnet-ajax/window/refresh-radgrid-on-close-of-radwindow.aspx

This works like a charm.  :)  My challenge is, however, while the grid refreshes itself beautifully, the context menu targeting the grid "disables" itself.  Specifically, when the user right-clicks, nothing happens at all.

When I refresh the page, the context menu "re-enables" itself, and I'm back off to the races.  

To resolve this, I've tried to DataBind the context menu in the Code Behind (in the AjaxRequest procedure as show in the forum post above).  But, that did not help.

So, I think my specific question is how do I "reactivate" a context menu targeting a RadGrid after I run the procedure shown in the forum post above?  

Thanks you very much for any help that you can provide.

Jim

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 09 Nov 2011, 07:06 AM
Hello,

Try with this link.

Thanks,
Jayehs Goyani
0
James
Top achievements
Rank 1
answered on 09 Nov 2011, 02:35 PM
Hi All,

Okay, I figured this out.

The botton line is that code was "firing" the "AjaxManager" object in the AjaxManager (not the Grids or other items).  Thus, I needed to set the controls to be updated by the "AjaxManager" itself.

If you look at the code below, I was not referencing my Context Menus when the AjaxManager itself was updated.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <ajaxsettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>

As soon as I added the menus, viola, worked like a charm:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <ajaxsettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                <telerik:AjaxUpdatedControl ControlID="FlowsContextMenu" />
                <telerik:AjaxUpdatedControl ControlID="OtherContextMenu" />
            </UpdatedControls>
        </telerik:AjaxSetting>

Thus, the code in the code behind (using the procedure mentioned in the post above) fires the "RadAjaxManager."  Remember that, and this is an easy problem to solve.  Here is a little snippet.

Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
 
    RadTreeView1.DataBind()
 
    RadGrid1.MasterTableView.SortExpressions.Clear()
    RadGrid1.MasterTableView.GroupByExpressions.Clear()
    RadGrid1.Rebind()
 
End Sub




Tags
Grid
Asked by
James
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
James
Top achievements
Rank 1
Share this question
or