Pass a parameter to a controller

  1. #1

    Pass a parameter to a controller

    Attached Thumbnails Click image for larger version. 

Name:	first_step.png 
Views:	1 
Size:	25.8 KB 
ID:	21911   Click image for larger version. 

Name:	second_step.png 
Views:	1 
Size:	32.6 KB 
ID:	21912  
  2. #2
    Let me know whether the following example helps you.

    <!DOCTYPE html>
    <html>
    <head runat="server">
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Panel Title="Parent Panel" Width="400" Height="400" Layout="FitLayout" runat="server">
            <Loader Url="~/Example/PanelContent" Mode="Component" runat="server">
                <LoadMask ShowMask="true" />
                <Params>
                    <ext:Parameter Name="parameter1" Value="Parameter 1" />
                </Params>
            </Loader>
        </ext:Panel>
    </body>
    </html>
    namespace SandBox.Controllers
    {
        public class ExampleController : System.Web.Mvc.Controller
        {
            public ActionResult Index()
            {
                return View();
            }
    
            public ActionResult PanelContent(string parameter1)
            {
                return Json(ComponentLoader.ToConfig(new Panel
                {
                    Title = parameter1,
                    Html = "Content"
                }));
            }
        }
    }
    Last edited by RCN; Feb 27, 2015 at 11:24 AM.
  3. #3
    Thank. Now suppose that you don't know in advance a value of parameter how can you give it to controller?
  4. #4
    Now suppose that you don't know in advance a value of parameter how can you give it to controller?
    Can you expand on that?

    You are able to pass as parameter the value of any control, any variable, etc, as shown below at line 12:
    <!DOCTYPE html>
    <html>
    <head runat="server">
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:TextField ID="_tfbParameter1" Text="Parameter 1" runat="server" />
        <ext:Panel Title="Parent Panel" Width="400" Height="400" Layout="FitLayout" runat="server">
            <Loader Url="~/Example/PanelContent" Mode="Component" runat="server">
                <LoadMask ShowMask="true" />
                <Params>
                    <ext:Parameter Name="parameter1" Value="#{_tfbParameter1}.getValue()" Mode="Raw" />
                </Params>
            </Loader>
        </ext:Panel>
    </body>
    </html>
  5. #5
    RCN thank you, thank, thanl, thank....
  6. #6
    I have attempt to adapt this with razor
    in my layout view i have add ID like this
                    .Items(
                        X.Container()
                         .ID("Menu") //ID that used in partial view that generate a submenu
                         .Loader(
                             X.ComponentLoader()
                                 .AutoLoad(true)
                                 .Url(Url.Action("ImageButtonsItem"))
                                 .Mode(LoadMode.Component)
                       )
                    )
    in this partial view i put this
            .Loader(
                X.ComponentLoader()
                    .Url(Url.Action("GetSubMenu"))
                    .Mode(LoadMode.Component)
                    .Params(new Parameter("submenu", "#{Menu.getValue()}"))      
            )
    But don't work. Thank again.
  7. #7
    RCN thank you, thank, thanl, thank....
    You're welcome.
    I have attempt to adapt this with razor
    in my layout view i have add ID like this
    ...
    ...
    But don't work. Thank again.
    Please post a complete (but simplified) code sample demonstrating how to reproduce the issue.
  8. #8
  9. #9
    Kdms, could you make it simpler? There are some images and css that are not necessary to reproduce the issue?

    If you could go down to bare minimum it would be really appreciated.
  10. #10
    I don't know how to make it easy. I am ready to take another approach.

Similar Threads

  1. Pass control from controller to view
    By simonespagna in forum 2.x Help
    Replies: 1
    Last Post: Oct 15, 2014, 1:10 PM
  2. [CLOSED] Pass TreePanel to Controller - MVC
    By Z in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Mar 06, 2014, 2:50 AM
  3. [CLOSED] How can I make ImageCommandColumn pass a Parameter
    By tobros in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 10, 2013, 5:31 AM
  4. [CLOSED] How to pass parameter when using HttpWriteProxy
    By Daly_AF in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 16, 2012, 9:46 PM
  5. How to pass object as a parameter?
    By diegovbs in forum 1.x Help
    Replies: 1
    Last Post: Jan 04, 2011, 5:53 PM

Posting Permissions