MVC + PartialViewResult And Model

  1. #1

    MVC + PartialViewResult And Model

    Hey All,
    i am trying to make this Example work on my end,
    and upon setting up the RenderMode to RenderTo, Everything is working ok but the Panel is rendered outside the Container Panel
    and Completly iggnores the FitLayouts.

    when i am trying to set it up as RenderMode.AddTo
    i get an Error in the ext.net js:

    "
    while ((match = re.exec(html))) { attrs = match[1]; srcMatch = attrs ? attrs.match(srcRe) : false; if (srcMatch && srcMatch[2]) { s = DOC.createElement("script"); s.src = srcMatch[2]; typeMatch = attrs.match(typeRe); if (typeMatch && typeMatch[2]) { s.type = typeMatch[2]; } hd.appendChild(s); } else if (match[2] && match[2].length > 0) { if (window.execScript) { window.execScript(match[2]); } else { window.eval(match[2]); } } }
    "
    on the line : window.execScript(match[2]);
    and dont see the rendered usercontrol.

    can you guys help me out.

    the sample is getting a treeNodeId from TreePanel and onClick Event calls the Controller to Load the needed UserControl
  2. #2
    Hi,

    Please show your code (markup, controller and view)
  3. #3
    hey,

    here is the markup
    this is the Example Control
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <ext:FitLayout runat="server"> 
        <Items>         
            <ext:Panel runat="server" Title="Example">             
                <Content>                 
                    Successfully loaded ...             
                </Content>         
            </ext:Panel>     
        </Items> 
    </ext:FitLayout>
    this is the Markup of the ViewPort, "WinMethodAccessRequest.aspx"
    <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
    
    <%@ 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 id="Head1" runat="server">
        <title></title>
    </head>                                                                                                                                             
    <body>
        <ext:ResourceManager ID="ScriptManager1" runat="server" />
        <script type="text/javascript">
               var loadPages = function () {
                   debugger;
               }
        </script>
        <ext:ViewPort ID="WinMethodAccessRequest" runat="server">
            <Content>
                   <ext:BorderLayout ID="BorderLayout1" runat="server">
                        <West>
                            <ext:TreePanel ID="TreeGrid_SDKRequest" runat="server" EnableDD="true">            
                                <Root>                
                                    <ext:AsyncTreeNode NodeID="NamespaceDeclaration_0" Text="NamespaceDeclaration" />            
                                </Root>            
                                <Loader>                
                                    <ext:TreeLoader DataUrl="/Data/GetRequestStructure" Timeout="60000">                    
                                        <BaseParams>                        
                                            <ext:Parameter Name="nodeId" Value="node.id" Mode="Raw"/>              
                                        </BaseParams>   
                                    </ext:TreeLoader> 
                               </Loader> 
                               <Listeners>
                                    <Click Handler="#{Pages}.load( { params: { containerId: 'Pages',nodeID: node.id }, scripts: true, url: '/Access/Example' } );" /> 
                               </Listeners>
                            </ext:TreePanel>    
                        </West>
                        <Center>
                             <ext:Panel ID="Pages" runat="server" Layout="Fit" Width="200"  />
                        </Center>
                   </ext:BorderLayout>
            </Content>
        </ext:ViewPort>
    </body>
    </html>
    and this is the Controler Code:

    public ActionResult WinMethodAccessRequest()
    {
    return this.View();
    }

    public ActionResult Example()
    {
    PartialViewResult result = new PartialViewResult();
    result.ContainerId = Request.Form["containerId"];
    result.RenderMode = RenderMode.AddTo;
    return result;
    }
  4. #4
    Hi,

    You have no form therefore need extract containerId from query string or just from Request
    result.ContainerId = Request["containerId"];

Similar Threads

  1. [CLOSED] Migrating to 2: PartialViewResult
    By PhilG in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: May 21, 2012, 9:27 AM
  2. [CLOSED] PartialViewResult and Model
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 26
    Last Post: Feb 14, 2011, 9:23 PM
  3. [CLOSED] PartialViewResult and Store refresh
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: May 20, 2010, 4:48 AM
  4. [CLOSED] PartialViewResult Controls in MVC 2
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Apr 26, 2010, 9:05 AM
  5. [CLOSED] PartialViewResult Problem
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 27, 2010, 11:15 AM

Tags for this Thread

Posting Permissions