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

[Solved] Ajaxifying

2 Answers 206 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 1
Rick asked on 31 May 2008, 11:28 PM
Yet another n00b question...

I'm using Master/Content pages. One content pages has the RadSplitter with simple right and left panes.  The right pane uses ContentURL to point to another apsx content page.

So, that content page contains a RadMenu and RadGrid.  The grid is bound to a DataView manually created on PageLoad.  One of the menu options is a menu of filter options for the grid.  The menu is configured to launch a RadMenu2_ItemClick event that applies a DataView.RowFilter then binds the DataView back to the gird.

What I'm attempting to achieve is a no-postback refresh of the grid.

I've tried adding the RadAJAXManager to the content page containing the menu and graph but I'm having no luck, and I'm also a little confused as to what I should be binding it to. The menu is launching the event, but the the grid is being refreshed...which should be ajaxifyied through the manager?

When I add the manager to the page and select Configure, neither the Menu nor the Grid show up as controls in the Property Builder.  I've tried using the examples in the Help files to configure it manually, but I'm still getting full page refreshes.

Am I approaching this filtering completly wrong, or just missing something with the usage of the manager?

Thanks in advance,
Rick

2 Answers, 1 is accepted

Sort by
0
Rick
Top achievements
Rank 1
answered on 01 Jun 2008, 04:37 AM

Hello Again,

I should mention that I've tried both putting the manager in the content page(s) and the master page (following the instructions here).

Master Page:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage00.master.cs" Inherits="MasterPage00" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<%--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">--%> 
<html style="height:100%" xmlns="http://www.w3.org/1999/xhtml">  
    <head runat="server">  
        <link href="ps_styles.css" rel="stylesheet" type="text/css"/>  
        <title>SomeDemoThing</title> 
        <asp:ContentPlaceHolder id="Header" runat="server"></asp:ContentPlaceHolder> 
    </head> 
    <body style="height:100%;margin:5px">  
        <form style="height:100%;margin:0px" id="form1" runat="server">  
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
                <AjaxSettings></AjaxSettings>  
            </telerik:RadAjaxManager> 
            <asp:ScriptManager ID="MasterPageScript" runat="server"></asp:ScriptManager> 
            <asp:ContentPlaceHolder id="MainContent" runat="server"></asp:ContentPlaceHolder> 
        </form> 
    </body> 
</html> 

With this in the Page_Load event of the Content Page (this is in the content page that the RadPane is pointing to using ContentURL)

        try  
        {  
            RadAjaxManager AjaxManager = (RadAjaxManager)this.Master.FindControl("RadAjaxManager1");  
            AjaxManager.AjaxSettings.AddAjaxSetting(RadMenu2, RadGrid2, null);  
        }  
        catch (NullReferenceException nex)  
        {  
            MessageBox.Show("NullTarded: " + nex.Message.ToString());  
        }  
        catch (Exception ex)  
        {  
            MessageBox.Show("E: " + ex.Message.ToString());  
        } 

When the page loads, the AjaxManager.AjaxSettings.AddAjaxSetting(RadMenu2, RadGrid2, null) command throws the NullReferenceException of "Object not set to an instance of an object".

Any help would be appreciated.

Thanks in advance,
Rick

0
Steve
Telerik team
answered on 03 Jun 2008, 07:09 AM
Hello Rick,

The ScriptManager control should be the first control on the page after the form tag - please make sure this is the case in your masterpage. Also you can use the static GetCurrent(Page) method of the AjaxManager in order to get reference to it, no matter how deeply nested the page/user control is:

RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(Page);

Greetings,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Rick
Top achievements
Rank 1
Answers by
Rick
Top achievements
Rank 1
Steve
Telerik team
Share this question
or