[CLOSED] Dynamically Added Tab not rendering partial view

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Dynamically Added Tab not rendering partial view

    Hi

    I am adding tabs dynamically using the javascript below.

     tab = tp.addTab({
                    id: id.toString(),
                    title: title,
                    layout:"Fit",
                    tabTip: config.title,
                    iconCls: config.icon || 'icon-applicationdouble',
                    closable: true,
                    autoStroll: true,
                    autoLoad: {
                        showMask: true,
                        url: config.url,
                        noCache: true,
                        maskMsg: "Loading '" + config.title + "'...",
                        scripts: true,
                        passParentSize: config.passParentSize,
                        params: {
                            "tabId": id.toString()
                        }
                    }
                });
    the
    the partialView action is the autoload Url. the parameter is passed to the action.

    public ActionResult ManageWorkItemPartial(String tabId)
            {
                Ext.Net.MVC.PartialViewResult partialViewResult = new Ext.Net.MVC.PartialViewResult(tabId);
                partialViewResult.RenderMode = RenderMode.AddTo;
                partialViewResult.SingleControl = true;
                partialViewResult.WrapByScriptTag = true;
                return partialViewResult;
            }
    But I am getting the error message.

    "AddTo mode can be applied to only a Component."

    Please how can I resolve this.

    Regards
    Last edited by Daniil; May 02, 2011 at 10:34 AM. Reason: [CLOSED]
  2. #2
    Hi,

    I guess your partial view consists the control(-s) which doesn't extend the Component class (for example, Store). If so, .AddTo is really wrong. Please set .RenderTo and remove
    partialViewResult.SingleControl = true;
  3. #3
    Hi,

    1. Please post partial view
    2. Please use " layout: 'fit' " <- lower case for layout name
    3. AutoScroll option cannot be used with "layout: 'fit'". Please remove one of the option (use required only)
  4. #4
    I have made your recommended changes. Now it not throwing the exception again. But the view is not rendering.

    The view page has the following just for sample.

     
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <ext:SplitButton ID="SplitButton1" runat="server" Text="Chart" Icon="Accept">
            <Menu>
                <ext:Menu ID="Menu2" runat="server">
                    <Items>                    
                       <ext:MenuItem ID="MenuItem3" runat="server" Text="Work Flow and Risk" Icon="Add" AutoDataBind="true" />
                    </Items>
                </ext:Menu>
            </Menu>
    </ext:SplitButton>
    Please can youi explain when to use RenderTo and AddTo.

    REgards
  5. #5
    the tab it is rendering to is just white with no content
  6. #6
    It rendered the view. But it ii not rendered inside the tab. but below the TabPanel. I will like it to be rendered inside the newly created tab.

    Regards
  7. #7
    I am trying so many options here and none seems to be working. It rendered under the tab panel when I set the render to tpmain which is my main tab panel. Everyother option to render to the dynamically added tab does not render any output.

    regards
  8. #8
    Hi,

    Please provide full test sample
    Here is my test case which works fine for me

    Page
    <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Monitor</title>    
        <script type="text/javascript">
            var addTab = function(tp, id, title, url){
                tab = tp.addTab({
                   id: id.toString(),
                   title: title,
                   layout:"fit",
                   tabTip: title,
                   //iconCls: config.icon || 'icon-applicationdouble',
                   closable: true,
                   autoLoad: {
                       showMask: true,
                       url: url,
                       noCache: true,
                       maskMsg: "Loading '" + title + "'...",
                       scripts: true,
                       //passParentSize: config.passParentSize,
                       params: {
                           "tabId": id.toString()
                       }
                   }
               });  
            };
     
        </script>
    </head>
    <body> 
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        
        <ext:TabPanel ID="TabPanel1" runat="server" Width="300" Height="250">
            <Items>
                <ext:Panel runat="server" Title="Tab 1" />
            </Items>
            <Buttons>
                <ext:Button runat="server" Text="Add tab" OnClientClick="addTab(#{TabPanel1}, 'tab2', 'Tab 2', '/Test/UC1');" />
            </Buttons>
        </ext:TabPanel>
    </body>
    </html>
    View
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <ext:SplitButton ID="SplitButton1" runat="server" Text="Chart" Icon="Accept">
            <Menu>
                <ext:Menu ID="Menu2" runat="server">
                    <Items>                    
                       <ext:MenuItem ID="MenuItem3" runat="server" Text="Work Flow and Risk" Icon="Add" AutoDataBind="true" />
                    </Items>
                </ext:Menu>
            </Menu>
    </ext:SplitButton>
    Controller
    public class TestController : Controller
        {
            public ActionResult Index()
            {
     
                return View();
            }
     
            public Ext.Net.MVC.PartialViewResult UC1(string tabId)
            {
                Ext.Net.MVC.PartialViewResult partialViewResult = new Ext.Net.MVC.PartialViewResult(tabId);
                partialViewResult.RenderMode = RenderMode.AddTo;
                partialViewResult.SingleControl = true;
                partialViewResult.WrapByScriptTag = true;
                return partialViewResult;
            }
            
        }
  9. #9
    I have sent a sample project through email to support@object.net.

    The project name is Symsuresample.zip.

    regards
  10. #10
    Hi ,

    Did you get my sample project?

    Regards
Page 1 of 2 12 LastLast

Similar Threads

  1. ASP.NET MVC partial rendering
    By wdk in forum 1.x Help
    Replies: 16
    Last Post: Jul 20, 2012, 12:01 PM
  2. [CLOSED] Problem rendering partial view
    By T3rryChan in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 03, 2012, 9:22 PM
  3. [CLOSED] Partial View Error
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 10, 2012, 10:32 AM
  4. [CLOSED] rendering desktop windows using partial view
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jan 11, 2012, 6:42 PM
  5. [CLOSED] RegisterOnReadyScript in MVC partial view
    By SandorD in forum 1.x Legacy Premium Help
    Replies: 22
    Last Post: Aug 10, 2011, 4:17 PM

Posting Permissions