Add Panels with Autoload to an accordion

  1. #1

    Add Panels with Autoload to an accordion

    Hello,

    I'm creating a quick MVC application. For the time being I managed to add Panels to a TabPanel and autoload content into them... apparently the crux of the problem was that to use RenderMode.RenderTo in the controller when creating the partial view, it is important to pass the body.id of the Panel where rendering to.

    I'm now trying to accomplish the same thing with an accordion but creating the accordion menu at page load time does not give me the option of specifying the target container as the panel body id. In the example:

    <script runat="server">
        public void Page_Load(object sender, EventArgs e)
        {
            foreach (var item in Model.SubSystems)
            {
                var panel = new Ext.Net.Panel(item.DisplayName, Icon.PageWhiteGear) { ID = "detailsPanel" + item.Id, Collapsed = true, Height = 300, Margins = "10" };
                panel.AutoLoad.Url = "/ConfigTool/Details/" + item.Id;
                panel.AutoLoad.Params.Add(new Ext.Net.Parameter("containerId", panel.ID));
    
                this.Accordion.Items.Add(panel);
            }
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Index</title>  
    </head>
    
    <body>
    
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:Panel ID="MainWindow" runat="server" Title="Sub-Systems" Padding="10">
        <Items>
            <ext:AccordionLayout ID="Accordion" runat="server" Animate="true">
                <Items>
                    
                </Items>
            </ext:AccordionLayout>    
        </Items>
    </ext:Panel>
    I can see the 3 calls to the appropriate controller and in the end the 3 partial view are appearing on the page but they are outside the accordion... kind of in the middle between the first and second accordion panel and indeed they don't hide and show when the accordions are collapsed or expanded.

    As an example here is the controller:
            
        public ActionResult Details(int id, string containerId)
            {
                var pr = new Ext.Net.MVC.PartialViewResult(containerId, Ext.Net.RenderMode.RenderTo);
                pr.ViewData = new ViewDataDictionary(new MyModel());
    
                return pr;
            }
    and the Details partial view:
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        public void Page_Load(object sender, EventArgs e)
        {
            this.DetailStore.DataSource = ViewData.Model;
            this.DetailStore.DataBind();
        }
    </script>
    <ext:GridPanel ID="GridPanel2" runat="server" Anchor="100%" Layout="AnchorLayout">
        <Store>
            <ext:Store ID="DetailStore" runat="server">
            [..... an ArrayReader here .....]
            </ext:Store>
        </Store>
        <ColumnModel runat="server" DefaultWidth="200">
            <Columns>
            [..... a ColumnSet here .....]
            </Columns>
        </ColumnModel>
    </ext:GridPanel>
    Any idea on how to force the 3 individual grids to stay each in its own accordion panel?
    Regards.
  2. #2
    Hello,

    I found out that giving the grid an ID in the details view will somehow screw up ext.net rendering. I had the same problem with the TabPanel, all the grids where appearing in the same tab:
    <ext:GridPanel ID="GridPanel2" runat="server" Anchor="100%" Layout="AnchorLayout">
    removing the ID will make this work, but of course the control cannot be referenced for other things. Another way I found out to solve the problem is to use
    PartialView.SingleControl = true
    in the controller, so every new thing added to the page will be prefixed with a GUID and will be unique.

Similar Threads

  1. Replies: 6
    Last Post: Jun 15, 2011, 12:07 PM
  2. Replies: 5
    Last Post: Nov 11, 2010, 7:33 PM
  3. Replies: 1
    Last Post: May 28, 2010, 6:52 AM
  4. Draggable Accordion Panels Easy?
    By cgountanis in forum 1.x Help
    Replies: 2
    Last Post: Dec 16, 2009, 11:48 AM
  5. [CLOSED] Vertical Scroll bars for the Accordion Panels
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 20, 2009, 9:06 AM

Tags for this Thread

Posting Permissions