[CLOSED] Rendering contents of Component Loader to a Panel in code behind

  1. #1

    [CLOSED] Rendering contents of Component Loader to a Panel in code behind

    Hello,
    I am using Ext.Net V2.5.2.10493 and c# in .net V 4.0.

    I am trying to load the result of a component loader into a panel from code. The following is my component loader...

    		public nsExtNet.ComponentLoader BrowserComponentLoader
    			( string token , string browserName , string browserContainerName , string configurationIds
    			, string extraFilters , string clickType , string launchArg , string referenceObject , string referenceObjectForFill
    			, System.Guid containerGuid , bool? autoFetch = null , bool isInWindow = true )
    		{
    			var requestContext = System.Web.HttpContext.Current.Request.RequestContext;
    
    			Ext.Net.ComponentLoader oXComLoader = new Ext.Net.ComponentLoader ( );
    
    			oXComLoader.Url = new System.Web.Mvc.UrlHelper ( requestContext ).Action ( "Browser" , "Clearview" );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "token" , token ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "browserName" , browserName ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "extraFilters" , extraFilters ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "clickType" , clickType ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "configurationIds" , configurationIds ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "launchArg" , launchArg ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "containerId" , "BrowserWindow" + containerGuid ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "ReferenceObjectForFill" , referenceObjectForFill ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "isHomePageBrowser" , "false" ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "containerName" , browserContainerName ) );
    			oXComLoader.Params.Add ( new Ext.Net.Parameter ( "isInWindow" , isInWindow.ToString() ) );
    
    			if ( autoFetch != null )
    			{
    				oXComLoader.Params.Add ( new Ext.Net.Parameter ( "autoFetch" , autoFetch.ToString ( ) ) );
    			}
    			oXComLoader.Mode = Ext.Net.LoadMode.Script;
    
    			return oXComLoader;
    
    		}
    How can i put the result of this component loader into a panel using code ( not in a view )?

    Thanks.
  2. #2
    Hello Emidio!

    I'll show you a simple example adding a button from code behind to a panel. If this does not help, please provide a runnable example reproducing your scenario and we'll try to help!

    Controller:
        public class issuesController : Controller
        {
            public ActionResult c61224_Index()
            {
                return View();
            }
    
            public ActionResult c61224_getPnlContents()
            {
                var panel = this.GetCmp<Panel>("pnl1");
    
                var btn = new Button() { Text = "Server side button" };
    
                btn.AddTo(panel);
    
                X.AddScript("console.log('returned from direct event.');");
    
                return this.Direct();
            }
        }
    View (named c61224_Index.cshtml):
    
    @{
        Layout = null;
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>c61224_Index</title>
    </head>
    <body>
        <div> 
            @Html.X().ResourceManager()
            @Html.X().Panel().ID("pnl1").Title("panel").Height(200)
            @Html.X().Button().Text("Add content").DirectEvents(de =>
            {
                de.Click.Url = Url.Action("c61224_getPnlContents");
            })
        </div>
    </body>
    </html>
    I hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] Component Loader Not Working
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: May 06, 2014, 6:43 AM
  2. Replies: 5
    Last Post: Jan 17, 2014, 10:29 AM
  3. [CLOSED] Question about component loader
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 22, 2013, 4:57 PM
  4. [CLOSED] Component Loader
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 13
    Last Post: Nov 13, 2012, 3:08 PM
  5. [CLOSED] CardLayout rendering ALL panel contents at once AND OUTSIDE the CardLayout?
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 26, 2009, 3:08 PM

Posting Permissions