Per Mangseth
Top achievements
Rank 1
Per Mangseth
asked on 16 May 2008, 12:22 PM
Hi!
I have a page built up with a master page and then contentpages. The AjaxManager resides in the MasterPage.
Here's the problem: I am using RadWindow in one of the contentpages, and in the CallBackFunction of the window I want to rebind a grid in the same contentpage. From what it seems, this would have been an easy task if I had the AjaxManager in the contentpage, though, as I mentioned, that is not the case here.
As it is not possible to send an AjaxRequest to an AjaxManagerProxy, how can the task described above be achieved?
To clarify the problem: I want to rebind a grid in a contentpage through a Javascript in the aspx file, and the AjaxManager resides in the MasterPage.
Cheers,
Erlend Haukland
I have a page built up with a master page and then contentpages. The AjaxManager resides in the MasterPage.
Here's the problem: I am using RadWindow in one of the contentpages, and in the CallBackFunction of the window I want to rebind a grid in the same contentpage. From what it seems, this would have been an easy task if I had the AjaxManager in the contentpage, though, as I mentioned, that is not the case here.
As it is not possible to send an AjaxRequest to an AjaxManagerProxy, how can the task described above be achieved?
To clarify the problem: I want to rebind a grid in a contentpage through a Javascript in the aspx file, and the AjaxManager resides in the MasterPage.
Cheers,
Erlend Haukland
8 Answers, 1 is accepted
0
Hi Per Mangseth,
You can get the RadAjaxManager instance in the MasterPage like this:
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("args");
and then handle the AjaxRequest eventhandler and do the necessary changes.
Regards,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You can get the RadAjaxManager instance in the MasterPage like this:
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("args");
and then handle the AjaxRequest eventhandler and do the necessary changes.
Regards,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Per Mangseth
Top achievements
Rank 1
answered on 19 May 2008, 07:21 AM
That did the trick! Works perfectly now.
Cheers,
Erlend Haukland
Cheers,
Erlend Haukland
0
Jeff
Top achievements
Rank 1
answered on 02 Jun 2008, 10:12 AM
I am trying to do the same thing and running into the same problem. Would it be possible for you to elaborate or provide some sample code on how you used GetCurrent to solve the issue.
Thanks.
Thanks.
0
Jeff
Top achievements
Rank 1
answered on 02 Jun 2008, 10:14 AM
Would it be possible for you to elaborate with some sample code. I still cannot get this to work.
Thanks
Thanks
0
Hello Jeff,
Please, review the help article about the RadAjaxManager in MasterPage scenario. Please, elaborate more on your case if you need further assistance.
Regards,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Please, review the help article about the RadAjaxManager in MasterPage scenario. Please, elaborate more on your case if you need further assistance.
Regards,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Jeff
Top achievements
Rank 1
answered on 02 Jun 2008, 05:54 PM
I did look at that page it was really not very helpful there are two code snippets which don;t really tell me hpw to get it to work.
Here is one. where is this supposed to go? how does it help me rebind thee grid?
RadAjaxManager.GetCurrent(Page)
here is the second one what is "content"? How does this trigger the codebehind logic to rebind the grid?:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function myContentClickHandler()
{
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("content");
}
</script>
</telerik:RadCodeBlock>
I have this in the code behind:
Here is one. where is this supposed to go? how does it help me rebind thee grid?
RadAjaxManager.GetCurrent(Page)
here is the second one what is "content"? How does this trigger the codebehind logic to rebind the grid?:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function myContentClickHandler()
{
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("content");
}
</script>
</telerik:RadCodeBlock>
I have this in the code behind:
Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As AjaxRequestEventArgs)
If e.Argument = "Rebind" Then
RadGrid4.MasterTableView.SortExpressions.Clear()
RadGrid4.MasterTableView.GroupByExpressions.Clear()
RadGrid4.Rebind()
ElseIf e.Argument = "RebindAndNavigate" Then
RadGrid4.MasterTableView.SortExpressions.Clear()
RadGrid4.MasterTableView.GroupByExpressions.Clear()
RadGrid4.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1
RadGrid4.Rebind()
End If
End Sub
How do I wire this to the ajaxrequest event?0
Hello Jeff,
Looking at your code-behind, it seems you just need to pass the appropriate argument (like "Rebind") so that the code execution will pass through the Grid Rebind logic. The ajaxRequest method client--side trigger a custom request which is handled through the AjaxRequest event server-side. You can find more information regarding the RadAjax client-side API here.
Greetings,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Looking at your code-behind, it seems you just need to pass the appropriate argument (like "Rebind") so that the code execution will pass through the Grid Rebind logic. The ajaxRequest method client--side trigger a custom request which is handled through the AjaxRequest event server-side. You can find more information regarding the RadAjax client-side API here.
Greetings,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Per Mangseth
Top achievements
Rank 1
answered on 03 Jun 2008, 08:00 AM
I'm using this function. :
function CallBackFunction(radWindow, returnValue)
{
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequestWithTarget('<%= RadGrid1.UniqueID %>', '');;
}
This is called when a RadWindow closes. I then have a RadAjaxManagerProxy like this:
<telerik:RadAjaxManagerProxy runat="server" ID="amProxy">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="lpAjaxGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
This rebinds my grid. So the trick for me was to use the ajaxRequestWithTarget, and then declare the control to be updated in the AjaxManagerProxy.
Cheers,
Erlend Haukland
function CallBackFunction(radWindow, returnValue)
{
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequestWithTarget('<%= RadGrid1.UniqueID %>', '');;
}
This is called when a RadWindow closes. I then have a RadAjaxManagerProxy like this:
<telerik:RadAjaxManagerProxy runat="server" ID="amProxy">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="lpAjaxGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
This rebinds my grid. So the trick for me was to use the ajaxRequestWithTarget, and then declare the control to be updated in the AjaxManagerProxy.
Cheers,
Erlend Haukland