Problem With ScriptManager on MasterPage

  1. #1

    Problem With ScriptManager on MasterPage

    Hi,


    I have a question about usage of coolite controls on asp MasterPage.
    I want to use toolbar as my menu, so I place toolbar on masterpage. To make it work, I added ScriptManager, also on MasterPage. Because I can only use one ScriptManager, I had to remove all other SM from content pages. And here is a trouble..
    When I use a ext:Button or ext:ToolbarButton, or any other control with AjaxEvent, I get a following error:


    Server Error in '/' Application.
    --------------------------------------------------------------------------------


    The control with ID 'm_menuStart' not found
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.


    Exception Details: System.Web.HttpException: The control with ID 'm_menuStart' not found


    Source Error:


    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:




    [HttpException (0x80004005): The control with ID 'm_menuStart' not found]
    Coolite.Ext.Web.ScriptManager.RaisePostBackEvent(S tring eventArgument) +1102
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +176
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563







    Code of MasterPage:



    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="BadzAktywny.SiteMaster" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head runat="server">
        <title></title>
        <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
        <asp:ContentPlaceHolder ID="HeadContent" runat="server"></asp:ContentPlaceHolder>
    </head>
    <body>
        <form runat="server">
          <ext:ScriptManager ID="smTemplate" runat="server">
            </ext:ScriptManager>
        <div class="page">
            <div class="header">
                <div class="title">
    
    
    ......
    
    
                    <ext:Toolbar ID="Toolbar1" runat="server">
                        <Items>
                            <ext:ToolbarButton ID="m_menuStart" runat="server" Text="Start">
                            <AjaxEvents>
                                                <Click OnEvent="m_menuAbout_Click">
                                                    <EventMask ShowMask="true" />
                                                    <ExtraParams>
                                                        <ext:Parameter Name="Param" Value="Menu 3" Mode="Value" />
                                                    </ExtraParams>
                                                </Click>
                                            </AjaxEvents>
    
    
                            </ext:ToolbarButton>
                        </Items>
                        </ext:Toolbar>
    
    
    
    
     and in codebehind:
    protected void m_menuAbout_Click(object sender, AjaxEventArgs e)
            {
                Response.Redirect("~/Pages/Account/Login.aspx");
            }



    This error is not present, when I use a different ScriptManager for each content page. But this is not a solution, because I had to remove SM from MasterPage, hence I cannot use toolbar as a menu.
    Can anybody provide a solution?

  2. #2

    RE: Problem With ScriptManager on MasterPage

    Hi,

    I cannot reproduce the issue
    Here is my test case
    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="Coolite.Sandbox.Panel.Site1" %>
    
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <asp:ContentPlaceHolder ID="head" runat="server">
        </asp:ContentPlaceHolder>
        
        <script runat="server">
            protected void m_menuAbout_Click(object sender, AjaxEventArgs e)
            {
                Ext.MessageBox.Alert("AjaxEvent", "Success").Show();
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ScriptManager ID="smTemplate" runat="server">
        </ext:ScriptManager>
        <ext:Toolbar ID="Toolbar1" runat="server">
            <Items>
                <ext:ToolbarButton ID="m_menuStart" runat="server" Text="Start">
                    <AjaxEvents>
                        <Click OnEvent="m_menuAbout_Click">
                            <EventMask ShowMask="true" />
                            <ExtraParams>
                                <ext:Parameter Name="Param" Value="Menu 3" Mode="Value" />
                            </ExtraParams>
                        </Click>
                    </AjaxEvents>
                </ext:ToolbarButton>
            </Items>
        </ext:Toolbar>
        </form>
    </body>
    </html>

Similar Threads

  1. Replies: 6
    Last Post: Sep 24, 2009, 10:57 PM
  2. Problem with ScriptManager
    By hansweber2 in forum 1.x Help
    Replies: 3
    Last Post: Jun 23, 2009, 9:24 AM
  3. [CLOSED] ScriptManager throw exception in my masterpage
    By pumpkin in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 04, 2009, 3:09 AM
  4. [CLOSED] Problem with ajaxmethod on masterpage
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 12, 2009, 12:39 PM
  5. Store in MasterPage problem
    By MrMp3 in forum 1.x Help
    Replies: 3
    Last Post: Nov 29, 2008, 11:45 PM

Posting Permissions