[CLOSED] [2.x] - MVC - Razor - How to add Portlet dynamically (Controller and Javascript)

  1. #1

    [CLOSED] [2.x] - MVC - Razor - How to add Portlet dynamically (Controller and Javascript)

    Hi,

    I have been looking for clue on how to add portlet dynamically using MVC Razor Controller and Javascript, but no luck.
    Do you have example on how to do it?

    Thanks
    DK
    Last edited by Baidaly; Jul 01, 2013 at 6:41 PM. Reason: [CLOSED]
  2. #2
  3. #3
    Hi,

    Thanks for reply, is not quite what i am looking for.
    Lets say i have a Portal control with pre-defined PortalColumns (i.e. 2 columns)
    and I want to dynamically (through DirectEvents) create Portlets in either PortalColumn
    (the content of the portlets will render different URLs.)

    Thanks
  4. #4
    Hi,

    I would use a Loader.
    https://examples2.ext.net/#/Loaders/.../Http_Handler/

    It is possible to implement it in Razor referring controller actions in the same way as the example demonstrates referring an HTTP handler.

    You can set up AutoLoad="false" for a Loader to defer loading till you need. To force loading or reload a PortalColumn by JavaScript you can call this:
    App.PortalColumn1.reload();
  5. #5
    Hi Daniil,

    I tried the following code and no luck, i must be missing a lots of things...

    ServerStatusView.cshtml
    @{
        ViewBag.Title = "Server Status Center";    var X = Html.X();} @(X.Panel().ID("Panel_101").Layout(LayoutType.Fit).Loader(X.ComponentLoader().Url(Url.Action("GetServerStatus")).Mode(LoadMode.Component).Params(new { containerId = "Panel_101" })) )
    ServerStatusController.cs
     public ActionResult GetServerStatus(string containerId)
            {            ComponentLoader.Render(new List<AbstractComponent>()                        {                             new Panel { Title="Item 1", Icon = Icon.UserBrown },                            new Panel { Title="Item 2", Icon = Icon.UserGray },                            new Panel { Title="Item 3", Icon = Icon.UserGreen }                        }                    );            return this.Direct();         }
  6. #6
    Hi Daniil,

    nvm, i think i got it. I use ContentResult.

    Thanks.
  7. #7
    Yes, you can use a ContentResult.

    There is also a ComponentConfigResult in Ext.NET which you can use here.

Similar Threads

  1. [CLOSED] Adding Portlet Dynamically JavaScript
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 04, 2014, 4:52 PM
  2. [CLOSED] [RAZOR] How to access ext.net controls from controller method
    By gets_gui in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 13, 2012, 8:12 AM
  3. Replies: 1
    Last Post: Jul 02, 2012, 6:19 PM
  4. [Razor] Populating form values from controller
    By machinableed in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 07, 2012, 10:42 AM
  5. [CLOSED] Get value from textfield in controller [Razor]
    By boris in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 10, 2012, 7:19 PM

Posting Permissions