How to load ImageButton form controller

  1. #1

    How to load ImageButton from controller

    Hello,
    I am new in Ext.net.mvc5. I try to display images buttons from database and not know how to process. In one controller i have put this code
            public ActionResult ImageButtonsItem()
            {
                ImageButton imageButton = new ImageButton();
                imageButton.Text = "Processing";
                imageButton.ID = "Bt_E_Configuration";
                imageButton.Height = 28;
                imageButton.Weight = 92;
                imageButton.ImageUrl = "~/Images/Entete/Simple/Configuration.png";
                imageButton.PressedImageUrl = "~/Images/Entete/Simple/Configuration.png";
                imageButton.DisabledImageUrl = "~/Images/Entete/Simple/Configuration.png";
                imageButton.Handler = "App.Bt_E_Report.setDisabled(false); App.Bt_E_Configuration.setDisabled(true); App.Bt_E_Processing.setDisabled(false); App.Bt_E_Import.setDisabled(false);";
                imageButton.DirectEvents.Click.Action = "Menu_Item";
                imageButton.DirectEvents.Click.ExtraParams.Add(new Parameter("param", "Partial1", ParameterMode.Value));
    
                return View(imageButton);
            }
    and i want to display it in my layout or if it possible to do with another approach i am ready to take it. Thank for all
    Last edited by kdms; Feb 19, 2015 at 10:47 AM.
  2. #2
    Kdms, welcome to Ext.NET.

    Can you better expalin your scenario? It would help us to find the right approach to you.
  3. #3
    I am try to realizie a menu like Microsoft Word Office menu. I want to get elements of this menu from database. For example this code display a menu with two labels (Processing and Import)
    <body>
        @X.ResourceManager()
        @(X.Viewport()
            .Layout(LayoutType.Border)
            .Items(
                X.Panel()
                    .Border(false)
                    .Region(Region.North)
                    .Split(false)
                    .BodyStyle("background-color:000;")
                    .Height(130)
                    .BodyPadding(0)
                    .Items(
                                    X.ImageButton()
                                        .Text("Processing")
                                        .ID("Bt_E_Processing")
                                        .Height(28)
                                        .Width(92)
                                        .ImageUrl(@Url.Content("~/Images/Entete/Simple/Processing.png"))
                                        .PressedImageUrl(@Url.Content("~/Images/Entete/Down/Processing_Down.png"))
                                        .DisabledImageUrl(@Url.Content("~/Images/Entete/Down/Processing_Down.png"))
                                        .Handler(" App.Bt_E_Report.setDisabled(false); App.Bt_E_Configuration.setDisabled(false); App.Bt_E_Processing.setDisabled(true); App.Bt_E_Import.setDisabled(false);")
                                        .DirectEvents(r =>
                                        {
                                            r.Click.Action = "Menu_Item";
                                            r.Click.ExtraParams.Add(new Parameter("param", "Partial3", ParameterMode.Value));
                                        }),
                                    X.ImageButton()
                                        .Text("Import")
                                        .ID("Bt_E_Import")
                                        .Height(28)
                                        .Width(65)
                                        .ImageUrl(@Url.Content("~/Images/Entete/Simple/Import.png"))
                                        .PressedImageUrl(@Url.Content("~/Images/Entete/Down/Import_Down.png"))
                                        .DisabledImageUrl(@Url.Content("~/Images/Entete/Down/Import_Down.png"))
                                        .Handler(" App.Bt_E_Report.setDisabled(false); App.Bt_E_Configuration.setDisabled(false); App.Bt_E_Processing.setDisabled(false); App.Bt_E_Import.setDisabled(true);")
                                        .DirectEvents(r =>
                                        {
                                            r.Click.Action = "Menu_Item";
                                            r.Click.ExtraParams.Add(new Parameter("param", "Partial2", ParameterMode.Value));
                                        }),
    
                                        X.Container()
                                            .ID("Menu_Container")
                                            .StyleSpec("height:90px; width:400%; background-color:transparent;")
                                                .Listeners(r =>
                                                {
                                                    r.Activate.Handler = "App.Bt_E_Configuration.setDisabled(true);";
                                                })
                                            .Loader(
                                                X.ComponentLoader()
                                                    .Url(Url.Action("Menu_Item"))
                                                    .Mode(LoadMode.Script)
                                            )
                    )
                    .Collapsible(false),
                //End of head menu
                //..... Onther part of layout
    Now i want to load all ImageButton() with a data comming from controller (database). So i want to load dynamically ImageButton with a properties of Menu entities for example. Please i am sorry about my english. Thank.
    Last edited by kdms; Feb 19, 2015 at 12:06 PM.
  4. #4
    Let me know whether the following example helps you: http://forums.ext.net/showthread.php?53142-Dynamic-Menu
  5. #5
    Thank RCN unfortunately, this example dont help me. I want to do this with Razor. My static menu look like this when i press on label Configuration
    Click image for larger version. 

Name:	menu1.png 
Views:	2 
Size:	45.9 KB 
ID:	21411
    And, when i press Processif label, it look like this
    Click image for larger version. 

Name:	menu2.PNG 
Views:	3 
Size:	46.5 KB 
ID:	21421
    I want to load all this labels dynamicaly. Thank again.

Similar Threads

  1. [CLOSED] Load window content from a controller method
    By registrator in forum 2.x Legacy Premium Help
    Replies: 21
    Last Post: Jan 22, 2015, 10:29 AM
  2. Replies: 2
    Last Post: Nov 13, 2013, 5:24 PM
  3. Load Panel from MVC Controller
    By stu in forum 2.x Help
    Replies: 1
    Last Post: Jun 18, 2012, 11:26 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. Load menu panel from controller
    By wadhah in forum 1.x Help
    Replies: 1
    Last Post: Oct 28, 2011, 1:48 PM

Tags for this Thread

Posting Permissions