[CLOSED] Dynamically adding view to panel MVC

  1. #1

    [CLOSED] Dynamically adding view to panel MVC

    Good day,

    I am having some issues dynamically adding a view to a panel since i upgrade to version 1.1. The code below worked using the 1.0 assemblies. Not sure what i need to change to get this working again. The call panel.load({ scripts: true, params: { containerId: 'panelProperties' }, url: url }); is no longer calling the action on the controller. I was able to dynamically load different panels using version 1.0 calling different controller urls.


        <ext:Viewport ID="Viewport1" runat="server" Layout="Border">
            <Items>
                <ext:TabPanel  runat="server" Width="300" MinWidth="300" MaxWidth="300"  IDMode="Explicit" Region ="West" >
                        <Items>
                            <ext:Panel    ID="panelWorkflows" runat="server" Title="Workflows" Layout="Fit">
                                <Items>
                                </Items>
                             </ext:Panel>
    
                            
                        </Items>
                        <Listeners>
                            
                        </Listeners>
                    </ext:TabPanel>
    
                <ext:Panel Frame="false" runat="server" Layout="Fit" AutoScroll="true"  LabelAlign="Left" Title="Templates" MonitorResize="true"  Region="Center" >
    
                    <Content>
                            <div id="graphSideBar" class="sideBar">
                            </div>
    
                            <div id="graphContainer" class="graph">
                            </div>
                    </Content>
    
                    <Items>
                    </Items>
    
                    </BottomBar>
                    <Listeners>
                        
                    </Listeners>
                </ext:Panel>
    
                <ext:Panel ID="panelProperties" runat="server"  Width= "350" Closable="false" HideCollapseTool="true" Collapsible= "true" Collapsed="true" Title="Properties"  Hidden="true" Layout="Form" AutoScroll="true"  MonitorResize="false"  Region="East" >
                      <AutoLoad    
                            AutoDataBind="true"
                            Url='/sample'                                            
                            ShowMask="true" 
                            MaskMsg="Loading Panel..."                          
                            MonitorComplete="false" NoCache="true"
                            >                             
                      </AutoLoad>                 
                </ext:Panel>
            </Items>
            <Listeners>
                 <Render Handler="" />
                 
           </Listeners>
        </ext:Viewport>
    The view to load on the panel

    <ext:Panel 
            ID="windowProperties" 
            runat="server" 
            Width="350"
             Height="510"
            Cls="items-view" 
            Layout="Fit"       
            Border="false">
                
               
                <Items>
    
                    
                </Items>
                
                <Listeners>
                   <Render Handler="" />
               </Listeners>
    </ext:Panel>




    This javascmethod is triggered on a button click

    ShowProperties: function () {
    
            WorkflowGraphHelper.initializingStatePropertiesWindow = true;
    
            var panel = panelProperties;
            panel.removeAll();
            var url = '/Flow/ShowProperties';
            panel.load({ scripts: true, params: { containerId: 'panelProperties' }, url: url });
            panel.setTitle('State Properties');
            panel.show();
            panel.expand(true);
            Viewport1.doLayout()
    
        },

    The controller action that should be triggered.

     public ActionResult ShowProperties(String containerId)
            {
                Ext.Net.MVC.PartialViewResult partialViewResult = new Ext.Net.MVC.PartialViewResult(containerId);
                partialViewResult.RenderMode = RenderMode.AddTo;
                partialViewResult.ViewName = "StateProperties";
                return partialViewResult;
    
            }
    Last edited by Daniil; Oct 14, 2011 at 7:21 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Didn't you forget to rebuild Ext.Net.MVC solution with new Ext.Net dlls?

    is no longer calling the action on the controller
    Can you check it using, for example, Fiddler or FireBug?

    Here is my test case which works.

    Example Page

    <%@ 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>
    <head runat="server">
        <title>Ext.Net.MVC Example</title>
    
        <script type="text/javascript">
            var onClick = function(panel) {
                var url = '/Partial/ShowProperties';
                panel.load({ 
                    scripts : true, 
                    params : { 
                        containerId : panel.id 
                    }, 
                    url : url,
                    nocache : true 
                });
            }
        </script>
    
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Button runat="server" Text="Show">
            <Listeners>
                <Click Handler="onClick(Panel1);" />
            </Listeners>
        </ext:Button>
        <ext:Panel 
            ID="Panel1" 
            runat="server" 
            Width="400" 
            Height="400" 
            Title="Test panel"
            Layout="FitLayout">
        </ext:Panel>
    </body>
    </html>
    Example Partial View

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <ext:Panel runat="server" BodyStyle="background-color: red;" />
    Example Controller Action

    public ActionResult ShowProperties(String containerId)
    {
        Ext.Net.MVC.PartialViewResult partialViewResult = new Ext.Net.MVC.PartialViewResult(containerId);
        partialViewResult.RenderMode = RenderMode.AddTo;
        partialViewResult.SingleControl = true;
        return partialViewResult;
    }
  3. #3

    Solved

    Thanks a lot for pointing out.

Similar Threads

  1. Replies: 4
    Last Post: Mar 07, 2012, 4:52 PM
  2. [CLOSED] Razor syntax for adding a partial view to a Panel
    By machinableed in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 23, 2012, 10:55 AM
  3. Replies: 0
    Last Post: Dec 29, 2010, 11:36 PM
  4. Replies: 0
    Last Post: Nov 17, 2010, 10:32 PM
  5. [CLOSED] Adding tree view to panel?
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 09, 2008, 12:27 PM

Tags for this Thread

Posting Permissions