[CLOSED] AutoLoad Parameter [ChangeLog]

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] AutoLoad Parameter [ChangeLog]

    In Ext.net 1.2 and 1.3 this sample works fine

    <ext:Panel ID="_pnl" runat="server" Flex="1" Layout="Fit" Width="250" Region="West"
                    Collapsible="true">
                    <AutoLoad Url="/ViewEngine/LoadWestMenu">
                        <Params>
                            <ext:Parameter Name="containerID" Value="#{_pnl}" Mode="Value" />
                        </Params>
                    </AutoLoad>
                </ext:Panel>
    When trying to upgrade to Ext.net 2.0

    <ext:Panel ID="_pnl" runat="server" Flex="1" Layout="Fit" Width="250" Region="West"
                    Collapsible="true">
                    <Loader Url="/ViewEngine/LoadWestMenu" runat="server" Mode="Component">
                        <AjaxOptions>
                            <Params>
                                <ext:Parameter Name="containerID" Value="#{_pnl}" Mode="Value" />
                            </Params>
                        </AjaxOptions>
                    </Loader>
                </ext:Panel>
    In the ?LoadWestMenu? action the containerID parameter is null.
    Any suggestion please?
    Last edited by Daniil; Apr 10, 2012 at 2:32 PM. Reason: [CLOSED]
  2. #2
    Hi,

    This is how you can load a component with
    Mode="Component"
    Example View
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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>Ext.Net.MVC v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Panel 
            runat="server" 
            Width="250" 
            Height="250"
            Layout="Fit">
            <Loader 
                runat="server" 
                Url="/Test/Load"  
                Mode="Component" />
        </ext:Panel>
    </body>
    </html>
    Example Controller Action
    public void Load()
    {
        Panel p = new Panel()
        {
            Html = "Hello World!"
        };
    
        ComponentLoader.Render(p);
    }
  3. #3
    Please update from SVN and use Params of Loader instead AjaxOptions params
    <Loader Url="/ViewEngine/LoadWestMenu" runat="server" Mode="Component">                    
                    <Params>
                            <ext:Parameter Name="containerID" Value="#{_pnl}" Mode="Value" />
                    </Params>
                </Loader>
  4. #4
    Quote Originally Posted by Vladimir View Post
    Please update from SVN and use Params of Loader instead AjaxOptions params
    <Loader Url="/ViewEngine/LoadWestMenu" runat="server" Mode="Component">                    
                    <Params>
                            <ext:Parameter Name="containerID" Value="#{_pnl}" Mode="Value" />
                    </Params>
                </Loader>
    Thanks Vladimir, but the parameter is always null
    this is the Action code
    public ContentResult LoadWestMenu(String containerID)
            {            
                var contentResult = new ContentResult();
                contentResult.Content = string.Format("<script>{0}</script>", _serviceWestMenu.CreateWestMenu()
                    .ToScript(RenderMode.AddTo, containerID));
                return contentResult;
            }
  5. #5
    Quote Originally Posted by Daniil View Post
    Hi,

    This is how you can load a component with
    Mode="Component"
    Example View
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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>Ext.Net.MVC v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Panel 
            runat="server" 
            Width="250" 
            Height="250"
            Layout="Fit">
            <Loader 
                runat="server" 
                Url="/Test/Load"  
                Mode="Component" />
        </ext:Panel>
    </body>
    </html>
    Example Controller Action
    public void Load()
    {
        Panel p = new Panel()
        {
            Html = "Hello World!"
        };
    
        ComponentLoader.Render(p);
    }
    This method works fine but we need to pass parameter into the action url otherwise we need to implement an Action for each loader.
  6. #6
    Quote Originally Posted by Daly_AF View Post
    Thanks Vladimir, but the parameter is always null
    this is the Action code
    public ContentResult LoadWestMenu(String containerID)
            {            
                var contentResult = new ContentResult();
                contentResult.Content = string.Format("<script>{0}</script>", _serviceWestMenu.CreateWestMenu()
                    .ToScript(RenderMode.AddTo, containerID));
                return contentResult;
            }
    The following works for me.

    Example View
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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>Ext.Net.MVC v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Panel
            ID="Panel1" 
            runat="server" 
            Width="250" 
            Height="250"
            Layout="Fit">
            <Loader 
                runat="server" 
                Url="/Test/Load"  
                Mode="Html">
                <Params>
                    <ext:Parameter Name="containerId" Value="#{Panel1}" Mode="Value" />
                </Params>
                <Listeners>
                    <Load Handler="eval(response.responseText);" />
                </Listeners>
            </Loader>
        </ext:Panel>
    </body>
    </html>
    Example Controller Action
    public ContentResult Load(String containerId)
    {
        var contentResult = new ContentResult();
        contentResult.Content = new Panel() { Html = "Hello World" }.ToScript(RenderMode.AddTo, containerId);
        return contentResult;
    }
  7. #7
    Quote Originally Posted by Daly_AF View Post
    This method works fine but we need to pass parameter into the action url otherwise we need to implement an Action for each loader.
    I don't think you will need to implement an action for each loader.

    Example View
    <%@ Page Language="C#" %>
      
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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>Ext.Net.MVC v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Panel 
            ID="Panel1"
            runat="server"
            Width="250"
            Height="250"
            Layout="Fit">
            <Loader 
                runat="server"
                Url="/Test/Load" 
                Mode="Component">
                <Params>
                    <ext:Parameter Name="containerId" Value="this.target.id" Mode="Raw" />
                </Params>
            </Loader>
        </ext:Panel>
    
        <ext:Panel 
            ID="Panel2"
            runat="server"
            Width="250"
            Height="250"
            Layout="Fit">
            <Loader 
                runat="server"
                Url="/Test/Load" 
                Mode="Component">
                <Params>
                    <ext:Parameter Name="containerId" Value="this.target.id" Mode="Raw" />
                </Params>        
            </Loader>
        </ext:Panel>
    </body>
    </html>
    Example Controller Action
    public ActionResult Load(string containerId)
    {
        Panel p = new Panel()
        {
            Html = containerId
        };
    
        ContentResult r = new ContentResult();
        r.Content = ComponentLoader.ToJson(p);
    
        return r;
    }
    Last edited by Daniil; Apr 09, 2012 at 6:02 PM.
  8. #8
    Quote Originally Posted by Daniil View Post
    The following works for me.

    Example View
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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>Ext.Net.MVC v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Panel
            ID="Panel1" 
            runat="server" 
            Width="250" 
            Height="250"
            Layout="Fit">
            <Loader 
                runat="server" 
                Url="/Test/Load"  
                Mode="Html">
                <Params>
                    <ext:Parameter Name="containerId" Value="#{Panel1}" Mode="Value" />
                </Params>
                <Listeners>
                    <Load Handler="eval(response.responseText);" />
                </Listeners>
            </Loader>
        </ext:Panel>
    </body>
    </html>
    Example Controller Action
    public ContentResult Load(String containerId)
    {
        var contentResult = new ContentResult();
        contentResult.Content = new Panel() { Html = "Hello World" }.ToScript(RenderMode.AddTo, containerId);
        return contentResult;
    }
    Hi Daniil,
    When I add the Load listener, in firebug console I have this error
    missing } in XML expression
    ...rm/', icon : el.iconCls });}}}},{iconCls:"#Information",text:"About",listeners:{...
    and the rendering of the component does not succeed.
  9. #9
    Quote Originally Posted by Daniil View Post
    I don't think you will need to implement an action for each loader.

    Example View
    <%@ Page Language="C#" %>
      
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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>Ext.Net.MVC v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Panel 
            ID="Panel1"
            runat="server"
            Width="250"
            Height="250"
            Layout="Fit">
            <Loader 
                runat="server"
                Url="/Test/Load" 
                Mode="Component">
                <Params>
                    <ext:Parameter Name="containerId" Value="this.target.id" Mode="Raw" />
                </Params>
            </Loader>
        </ext:Panel>
    
        <ext:Panel 
            ID="Panel2"
            runat="server"
            Width="250"
            Height="250"
            Layout="Fit">
            <Loader 
                runat="server"
                Url="/Test/Load" 
                Mode="Component">
                <Params>
                    <ext:Parameter Name="containerId" Value="this.target.id" Mode="Raw" />
                </Params>        
            </Loader>
        </ext:Panel>
    </body>
    </html>
    Example Controller Action
    public ActionResult Load(string containerId)
    {
        Panel p = new Panel()
        {
            Html = containerId
        };
    
        ContentResult r = new ContentResult();
        r.Content = ComponentLoader.ToJson(p);
    
        return r;
    }
    In this sample, It works fine.
  10. #10
    Quote Originally Posted by Daly_AF View Post
    When I add the Load listener, in firebug console I have this error
    missing } in XML expression
    ...rm/', icon : el.iconCls });}}}},{iconCls:"#Information",text:"About",listeners:{...
    and the rendering of the component does not succeed.
    Did you update from SVN? It has been fixed recently.
    http://forums.ext.net/showthread.php...ll=1#post78952
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Ext.Net 2.1 version changelog
    By Daly_AF in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 14, 2012, 10:59 AM
  2. [CLOSED] ChangeLog Questions
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Jul 12, 2012, 2:56 PM
  3. Panel AutoLoad Parameter
    By YarikK78 in forum 1.x Help
    Replies: 7
    Last Post: Feb 15, 2012, 10:35 AM
  4. how to transfer parameter in Panel's AutoLoad
    By supermanok in forum 1.x Help
    Replies: 8
    Last Post: Jul 17, 2009, 12:40 PM
  5. [CLOSED] HOW TO TRANSFER PARAMETER IN PANEL'S AUTOLOAD...
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 0
    Last Post: Jul 14, 2009, 12:10 AM

Tags for this Thread

Posting Permissions