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

[Solved] RadAjaxManager on Content Page referencing control on Master Page

3 Answers 201 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 15 Jun 2009, 07:06 PM
Sorry for the repeat question.  I am new with Ajax and for some reason I'm just not understanding the other posts.

I have a RadAjaxManager on a content page that updated a RadGrid.  I have a search textbox on my Master Page that I want the grid to respond to, but I can't figure out how to hook it up.

Can somebody explain how I can do this?  Again, I'm sorry for the repeat questions, but like I said I am new with Ajax and am having problems comprehending the other posts.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Jun 2009, 05:50 AM
HI Mike,
You can place the  RadAjaxManager in your MasterPage and then  ajaxify and update every single control in your application.
Here is one online document explaining the same.
MasterPages: ajaxify and update controls in master and content page

-shinu.

0
John
Top achievements
Rank 1
answered on 16 Jun 2009, 01:21 PM
Thank you for the example.  In that example, it appears the Master Page's On_Load event is hooking up the content page's controls:

Label Label1 = (Label)ContentPlaceHolder1.FindControl("Label1");

What if the ContentPage doesn't have a Label1 control?  This seems like bad architecture to me.  I would assume the Content Page should load it's own content because each Content Page will have different controls.

Later in the example, I see the Content Page's On_Load event is hooking up it's contents to the AjaxManager on the Master Page.  This is how I expect it would work - however, I am confused because it's happening in both Master and Content pages.  Does this example show two separate ways to accomplish the same thing, or are both methods required?

Thanks for your help!
0
Iana Tsolova
Telerik team
answered on 22 Jun 2009, 10:24 AM
Hi Mike,

First to your questions: You can make your search textbox update the grid in the content page via ajax by adding the following ajax setting in the content page Page_Load or Page_PreRender event handlers:

TextBox txtSearch = this.MasterPage.FindControl("<YourSearchTextBoxID>"as TextBox;  
<YourAjaxManager>.AjaxSettings.AddAjaxSetting(txtSearch, <YourGrid>); 

More information on adding ajax settings dynamically is available here.

Regarding the samples in the help topic: Indeed, it shows how you can do the same thing in different ways. The first sample illustrates how to implement your scenario in the master page and the second, how to achieve it from the content page. It is your choice where you want to place your code.

I hope this helps.

Sincerely yours,
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.
Tags
Ajax
Asked by
John
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
John
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or