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

Update radgrid from radwindow using MasterPages

6 Answers 104 Views
Window
This is a migrated thread and some comments may be shown as answers.
Adam Hubble
Top achievements
Rank 1
Adam Hubble asked on 17 Jul 2009, 09:21 PM

Hi,

I have got a parent page with a radgrid being updated using AJAX from a radwindow - as per the demo and advice here:

http://www.telerik.com/community/forums/aspnet-ajax/window/update-radgrid.aspx

However, although I can get this working fine with raw pages, it does not work when using Master Pages - this seems to be the case because ajaxmanagerproxy does not have ajaxRequest as one of its properties.

My master pages have the ajaxmanager in them and content pages then use the proxy. How should I get a radgrid to update from a radwindow using ajax when using masterpages (at least for the parent page)?
 
Many thanks,
Matt

p.s. I think there should definately be a proper demo example for this scenario as "real" projects will use master pages - if there is already, I couldn't find it.

6 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 20 Jul 2009, 11:53 AM
Hello Matt Davis,

I believe that the RadAjaxManager's HowTo section will be of help.


Greetings,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Adam Hubble
Top achievements
Rank 1
answered on 20 Jul 2009, 12:48 PM
Hi Georgi,

Thanks but this only gets me some of the way there. How do I hook this up to the server side code I want to run.

So I now have:

function refreshGrid(arg) {
if (!arg) {
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>).ajaxRequest("Rebind");
    }
else {
 $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>).ajaxRequest("RebindAndNavigate");
    }
}

Without master pages I would then catch the value passed to ajaxRequest in the radajaxmanager ajaxRequest event handler...

if e.Argument = "Rebind" then

clear sort, clear group, databind

elseIf e.Argument = "RebindAndNavigate" then

do something else
-----

I can't see how to hook up to this because the proxy does not have this event handler in the content page code behind.

Thanks,
Matt

p.s. 2 links with examples at the bottom of the page you suggested are broken.

0
Accepted
Iana Tsolova
Telerik team
answered on 20 Jul 2009, 03:16 PM
Hello Matt,

Indeed, you can handle the the AjaxRequest event in the content page/user control with the proxy as well. You can try the following code there:

protected void Page_Load(object sender, EventArgs e)  
{  
   RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);  
   manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);  
}  
protected void manager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)  
{  
   //handle the manager AjaxRequest event here  
}  

I hope this helps.

Best wishes,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Adam Hubble
Top achievements
Rank 1
answered on 20 Jul 2009, 05:35 PM

Hi Iana, I tried to implement the code you provided in vb.net as...

Protected Sub Page_Load(sender As Object, e As EventArgs)
 Dim manager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)
 manager.AjaxRequest += New RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest)
End Sub

Protected Sub manager_AjaxRequest(sender As Object, e As Telerik.Web.UI.AjaxRequestEventArgs)
 'handle the manager AjaxRequest event here  
End Sub

It seems like it should be a pretty straight forward convert, but I am getting a blue line error in Visual Studio under manager.AjaxRequest (AjaxRequest does not appear in the intellisense either).

Thanks
0
Accepted
Iana Tsolova
Telerik team
answered on 21 Jul 2009, 03:08 PM
Hello Matt,

Here is the VB.NET version of the code:

Protected Sub Page_Load(ByVal sender As ObjectByVal e As EventArgs) Handles Me.Load  
    Dim manager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)  
    AddHandler manager.AjaxRequest, AddressOf manager_AjaxRequest  
End Sub 
Protected Sub manager_AjaxRequest(sender As Object, e As Telerik.Web.UI.AjaxRequestEventArgs)  
    'handle the manager AjaxRequest event here  
End Sub  

Check it out and let me know how it is.

Best wishes,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Adam Hubble
Top achievements
Rank 1
answered on 21 Jul 2009, 07:14 PM
Hi Iana, thanks a lot this worked great.

Others should note I also had to set the proxy to update the grid before it worked. With Master Pages, the design time property builder window does not show the proxy but it can be declared manually with ease...

 

<telerik:AjaxSetting AjaxControlID="RadAjaxManagerProxy1">  

 

 

<UpdatedControls 

 

 

<telerik:AjaxUpdatedControl ControlID="RadGrid1" />  

 

 

</UpdatedControls

 

</telerik:AjaxSetting>

 

 

 

 

 

 

 

Tags
Window
Asked by
Adam Hubble
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Adam Hubble
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or