[CLOSED] [MVC] Ext.onReady is not a function - Help?

  1. #1

    [CLOSED] [MVC] Ext.onReady is not a function - Help?

    Hi,

    I downloaded and installed Coolite today and I tried some of the examples on my own computer.

    Now I can always see the design but if I run it, I always get a blank page.

    My code is just:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="About.aspx.cs" Inherits="MvcApplication4.Views.Home.ViewContentPage1" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <ext:ScriptManager ID="ScriptManager1" runat="server" />
    
        <ext:Panel ID="Panel1" runat="server" Height="300" Title="Title">
            <Content>
                <ext:BorderLayout ID="BorderLayout1" runat="server">
                    <West Collapsible="true" Split="true">
                        <ext:Panel ID="Panel2" runat="server" Title="West" Width="175">
                        </ext:Panel>
                    </West>
                </ext:BorderLayout>
            </Content>
        </ext:Panel>
    
    </asp:Content>
    If I use firebug, it tells me, that there is an error on line 16:

    Ext.onReady is not a function

    If I look into the script, line 16 is:

    Ext.onReady(function(){Ext.QuickTips.init();Coolite.Ext.ScriptManagerUniqueID='ctl00$MainContent$ScriptManager1';Coolite.Ext.ThisUrl='http://localhost:1141/Home/About';this.ctl00_MainContent_Panel1=new
    Ext.Panel({id:"ctl00_MainContent_Panel1",renderTo:"ctl00_MainContent_Panel1_Container",height:300,layout:"border",serverID:"BorderLayout1",items:{id:"ctl00_MainContent_Panel2",split:true,region:"west",collapsible:true,width:175,title:"West",serverID:"Panel2"},title:"Title",serverID:"Panel1"});this.ctl00_MainContent_Panel2=Ext.getCmp('ctl00_MainContent_Panel2');});Ext.BLANK_IMAGE_URL="/extjs/resources/images/default/s-gif/coolite.axd";<a class="sourceLine">17</a>
    What did I do wrong?
  2. #2

    RE: [CLOSED] [MVC] Ext.onReady is not a function - Help?

    Did you add in the needed web.config settings?

    Search for 'web.confg' in the forum search and you should find a result pretty quick.
  3. #3

    RE: [CLOSED] [MVC] Ext.onReady is not a function - Help?

    Hi Siran,

    There might be a couple of things going wrong here.

    1. The BorderLayout requires the <Center> region to be defined. I thought Toolkit would throw an Exception if the <Center> region was not present, but I just tested and no Exceptions was thrown. I'm going to look into why that is not happening.

    If you add a <Center> region you should be one step closer to making this work.

    Example

    <ext:Panel ID="Panel1" runat="server" Height="300" Title="Title">
        <Body>
            <ext:BorderLayout ID="BorderLayout1" runat="server">
                <Center>
                    <ext:Panel ID="Panel2" runat="server" Title="Center" />
                </Center>
                <West Collapsible="true" Split="true">
                    <ext:Panel ID="Panel3" runat="server" Title="West" Width="175" />
                </West>
            </ext:BorderLayout>
        </Body>
    </ext:Panel>
    2. As noted by mindcore1, you might be missing a node in your Web.config file. The node should be added automatically when using the controls in Visual Studio (or Visual Web Developer Express). Please double check that the following node has been added to the <httpHandlers> section of your Web.config file and if it's missing, please add.

    Example

    <httpHandlers>
      <add path="*/coolite.axd" verb="*" type="Coolite.Ext.Web.ResourceManager" validate="false" />
    </httpHandlers>
    Hope this helps.

    Geoffrey McGill
    Founder
  4. #4

    RE: [CLOSED] [MVC] Ext.onReady is not a function - Help?

    geoffrey.mcgill (11/10/2008)Hi Siran,

    There might be a couple of things going wrong here.

    1. The BorderLayout requires the <Center> region to be defined. I thought Toolkit would throw an Exception if the <Center> region was not present, but I just tested and no Exceptions was thrown. I'm going to look into why that is not happening.

    If you add a <Center> region you should be one step closer to making this work.
    If found that error after posting. I deleted all of the BorderLayout and created a new one. Didn't help.


    geoffrey.mcgill (11/10/2008)2. As noted by mindcore1, you might be missing a node in your Web.config file. The node should be added automatically when using the controls in Visual Studio (or Visual Web Developer Express). Please double check that the following node has been added to the <httpHandlers> section of your Web.config file and if it's missing, please add.

    Example

    <httpHandlers>
      <add path="*/coolite.axd" verb="*" type="Coolite.Ext.Web.ResourceManager" validate="false" />
    </httpHandlers>
    Hope this helps.
    I did include this node. My code is:

     <httpHandlers>
       <remove path="*.asmx" verb="*" />
       <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        validate="false" />
       <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        validate="false" />
       <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        validate="false" />
       <add path="*.mvc" verb="*" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        validate="false" />
       <add path="*/coolite.axd" verb="*" type="Coolite.Ext.Web.ResourceManager" validate="false" />
      </httpHandlers>
            <httpModules>
                <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add name="AjaxRequestModule" type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web" />
        </httpModules>
  5. #5

    RE: [CLOSED] [MVC] Ext.onReady is not a function - Help?

    Hi Siran,

    I just finished testing a complete MasterPage + Page + UserControl sample and everything appears to render properly.

    Example (MasterPage)

    <%@ Master Language="C#" %>
    
    <%@ 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 id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="form2" runat="server">
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" />
        </form>
    </body>
    </html>
    Example (Page)



    <%@ Page Language="C#" MasterPageFile="MasterPage2.Master" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <%@ Register src="UserControl2.ascx" tagname="UserControl2" tagprefix="uc1" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <ext:ScriptManager ID="ScriptManager1" runat="server" />
        <ext:Panel ID="Panel1" runat="server" Title="My Panel" Frame="true" Height="300">
            <Body>
                <ext:BorderLayout ID="BorderLayout1" runat="server">
                    <West Collapsible="true" Split="true">
                        <ext:Panel ID="Panel2" runat="server" Title="West" Frame="true" Width="175" Html="West" />
                    </West>
                    <Center>
                        <ext:Panel ID="Panel3" runat="server" Header="false">
                            <Body>
                                <uc1:UserControl2 ID="UserControl21" runat="server" />
                            </Body>
                        </ext:Panel>
                    </Center>
                </ext:BorderLayout>
            </Body>
        </ext:Panel>
    </asp:Content>
    Example (UserControl)



    <%@ Control Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Panel4.DataBind();
        }
    </script>
    
    <ext:FitLayout ID="FitLayout1" runat="server">
        <ext:Panel ID="Panel4" runat="server" Title="Inner Panel Center" Frame="true" Html="<%# DateTime.Now.ToLongTimeString() %>" />
    </ext:FitLayout>
    Hope this helps.

    Geoffrey McGill
    Founder
  6. #6

    RE: [CLOSED] [MVC] Ext.onReady is not a function - Help?

    Geoffrey:


    I haven't played with Coolite using MVC, however, I noticed that Siran loads the assembly for this in his provided web.config. Is there something special he has to do to make the Toolkit aware that it's running under MVC?

    I just recall some property that you had added early on to the toolkit. I don't know if this is related to his problem, but I thought it was worth mentioning.

    -mindcore
  7. #7

    RE: [CLOSED] [MVC] Ext.onReady is not a function - Help?

    Ah, I didn't noticed that Siran is using MVC. I didn't catch the Views reference in the MasterPage.

    If this is the case (please confirm Siran), then I think the problem is being caused by the MVC routing engine munching the coolite.axd resource paths. The following forum post outlines the problem and presents a solution, see*http://forums.ext.net/showthread.php?postid=525.aspx


    This is also easy to confirm by setting*CleanResourceUrl="false" on the <ext:ScriptManager>. The the ful routing fix is presented in the link above.*


    Hope this helps.


    Geoffrey McGill
    Founder
  8. #8

    RE: [CLOSED] [MVC] Ext.onReady is not a function - Help?

    Thanks. That was the solution. I checked through the forums before asking but I seem to have missed that one.

    It's working now.

Similar Threads

  1. [CLOSED] Calculator Function
    By iansriley in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 02, 2010, 8:29 AM
  2. Ext.onReady,userControl and ComboBox
    By dukeucha in forum 1.x Help
    Replies: 1
    Last Post: Jun 14, 2010, 6:53 AM
  3. [CLOSED] [1.0] How to add client script in before OnReady?
    By bsnezw in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 14, 2010, 10:56 AM
  4. [CLOSED] which Ext.onReady gets executed first?
    By pkellner in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 15, 2008, 3:40 PM
  5. Replies: 1
    Last Post: Feb 15, 2008, 10:06 AM

Posting Permissions