[CLOSED] [MVC] Getting AbstactComponent from partial view

  1. #1

    [CLOSED] [MVC] Getting AbstactComponent from partial view

    Hello, please take a look at my sample

    view1.cshtml
    @using Ext.Net
    @using Ext.Net.MVC
    @model  Models.ViewModel.Frames.IViewFrame
    @{
        var ext = Html.X();
    
        Html.RenderPartial("Grid", Model);
    
        if (Model.Details != null && Model.Details.Count > 0)
        {
            @(ext.BoxSplitter())
            @(ext.TabPanel()
                 .Layout(LayoutType.Fit)
                 .Flex(1)
                 .ItemsFromPartial("GridTabs", Model.Details))
            }
        }
    }
    GridTabs.cshtml
    @model  ICollection<Models.ViewModel.Frames.IViewFrame>
    @{
        foreach (var viewFrame in Model)
        {
            Html.RenderPartial("GridContainer", viewFrame);
        }
    }
    I want to avoid the GridTabs.cshtml and move its logic in to view1.cshtml

    Something like:

    @using System.Collections.ObjectModel
    @using Ext.Net
    @using Ext.Net.MVC
    @model  Models.ViewModel.Frames.IViewFrame
    @{
        var ext = Html.X();
    
        Html.RenderPartial("Grid", Model);
    
        if (Model.Details != null && Model.Details.Count > 0)
        {
            var items = new Collection<AbstractComponent>();
            foreach (var viewFrame in Model.Details)
            {
                items.Add(MAKE_ABSTACT_COMPONENT_FROM_PARTIAL_VIEW("GridContainer", viewFrame ));    //// Need this method
            }
            @(ext.BoxSplitter())
            @(ext.TabPanel()
                 .Layout(LayoutType.Fit)
                 .Flex(1)
                 .Items(items))
                 //.ItemsFromPartial("GridTabs", Model.Details))
            }
        }
    }
    Is there any such method (MAKE_ABSTACT_COMPONENT_FROM_PARTIAL_VIEW) in Ext.net?
    Last edited by Baidaly; Oct 30, 2013 at 8:24 PM. Reason: [CLOSED]
  2. #2
    Hello!

    Welcome to our forum!

    I'm afraid, we don't have such method. You should use loop and add each item to the control.

    However, I'll ask my colleagues.
  3. #3
    Hi,

    In other words, you need to call ItemsFromPartial several times on some container?

    This is working:
    @Html.X().Container().ItemsFromPartial("Partial").ItemsFromPartial("Partial")
    I think it can be done in a loop.

    View
    @{
        var X = Html.X(); 
    }
    
    <!DOCTYPE html>
    <html>
    <head>
        <title>Ext.Net.MVC v2 Example</title>  
    </head>
    <body>
        @X.ResourceManager()
    
        @{
            var ct = new Container().ToBuilder();
    
            for (int i = 0; i < 5; i++) {
                ct.ItemsFromPartial("Partial", i);
            }
        }
    
        @ct           
    </body>
    </html>
    Partial View
    @model int
    
    @{
        var X = Html.X(); 
    }
    
    @X.Label().Html("Hello " + Model + "!<br/>")
    P.S. It is nice to see someone from Russia as a premium member:)
  4. #4
    Thank you Daniil, I'll try...

    ps. Yeah, I'm glad to see russian developers and supports in this project...

    ---

    upd:
    I just checked this approach. It works well.
    We can close this thread.
    Thx again.
    Last edited by alex303; Oct 30, 2013 at 6:10 PM.
  5. #5
    Hi @alex303,

    Just for your information - Ext.NET hires!

Similar Threads

  1. [CLOSED] Partial View
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Jul 16, 2013, 1:16 PM
  2. [CLOSED] Partial View not Rendering
    By RCM in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 01, 2013, 3:10 AM
  3. [MVC] How to use a partial view in a window?
    By KBorkiewicz in forum 2.x Help
    Replies: 7
    Last Post: Nov 21, 2012, 11:11 PM
  4. [CLOSED] [2.1] MVC Partial View
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 23, 2012, 12:04 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