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

Refresh Radgid on Radwindow close without postback

3 Answers 228 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kaushal
Top achievements
Rank 1
Kaushal asked on 18 Oct 2011, 11:48 AM
Hi ALL,

         Let me tell you my current flow and what i want to do.

         I have one parent page with link as "Add New" and RadGrid, when user click on link radwindow will get open.

        User will fill up the details and click on save button, record will get save into DB and want to refresh the RadGrid on parent page.

        I have used RadAjaxManager on parent page to call radajaxrequest to refresh the grid.and update that particular grid only,

        But on same page i have to maintain history.back functionality on cancel button, whenever ajaxrequest get fire page will get postback.so when user click on cancel button user will stay on same page rather than previous page.

       Can you please help me out to refresh the parent page grid without any postback, so i can mange window.history on cancel button.
 

      

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Oct 2011, 02:52 PM
Hello Kaushal,

Check the following forum thread which explains a similar scenario.
Refresh RadGrid On Close of RadWindow

Thanks,
Shinu
0
Kaushal
Top achievements
Rank 1
answered on 19 Oct 2011, 05:41 AM

Thanks Shinu for your quick reply.

I had gone through your provided reference link and read the discussion.

I had used same approch to refresh my parent page grid on child window close.

Please check my code below.

// Parent page JS.
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
                 function refreshGrid(arg)
                 {
                // Fire ajax request according to argument.
    if(arg != '')
    {
             $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);                 
    }
                 }
                    </script>
    </telerik:RadCodeBlock>
  
// Parent page html
  
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
        ClientEvents-OnRequestStart="RequestStart" ClientEvents-OnResponseEnd="ResponseEnd">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radgrd" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="radgrd">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radgrd"  />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
  
// Child Page JS
  
function GetRadWindow() {
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}
function CloseWindowWithArgs(args) {
    var oWin = GetRadWindow();
    oWin.close();
    oWin.BrowserWindow.refreshGrid(args);
}
// Parent page ajaxrequest
  
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            // Ajax request 
            if (e.Argument == Constants.STATUS)
            {
                 radgrd.Rebind();
            }
  
        }
But whenever ajaxrequest call, page get postback and i can't manage window.history.go(-1).

So, is there any way to refresh grid without page get postback? so i can manage pare history.
0
Tsvetina
Telerik team
answered on 21 Oct 2011, 01:48 PM
Hi Kaushal,

Can you confirm that RadAjaxManager does not come as null in your client method? From what I understand, it is on a parent page of the one that you use to access it, so simply using its client ID will not work. If so, you should try the GetCurrent() method:
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest(arg);


All the best,
Tsvetina
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
Tags
Grid
Asked by
Kaushal
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Kaushal
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or