[CLOSED] [RAZOR] Iterate over controls in FormPanel

  1. #1

    [CLOSED] [RAZOR] Iterate over controls in FormPanel

    Hi

    I've defined the FormPanel outlined below. Within my controller given the reference to the FormPanel I want to iterate over the controls defined with the form.

    I've tried the .Items, .Controls properties of the FormPanel but these properties don't seem to be initialised.

    CSHTML Code:

      Html.X().FormPanel()
        .ID("formPanel")
        .Title("formPanel")
        .Collapsible(true)
        .ButtonAlign(Alignment.Right)
        .Layout(LayoutType.HBox)
        .Items(items =>
        {
          items.Add(Html.X().Panel()
            .ID("Panel1")
            .Title("Panel1")          
            .Closable(true)
            .CloseAction(CloseAction.Hide)
            .Add(Html.X().DateField()
                ...
            );
            
          items.Add(Html.X().Panel()
            .ID("Panel2")
            .Title("Panel2")          
            .Closable(true)
            .CloseAction(CloseAction.Hide)
            .Add(Html.X().ComboBox()
                ...
            );
             ...
    Controller Code:

            public ActionResult OnDirectClick()
            {
                var formControls = X.GetCmp<FormPanel>("formPanel").Items;
           
               foreach(AbstractComponent control in formControls )
                {
                   // Do operation             
                }
    
                ...
            }
    Last edited by Daniil; May 11, 2012 at 4:30 PM. Reason: [CLOSED]
  2. #2
    It is impossible:
    - Controller's action doesn't know anything about view
    - Razor doesn't operate by controls term (there are no any controls under Razor), therefore it is impossible ever inside Razor view
    - X.GetCmp<> doesn't return real instance, it returns proxy object to manage client side properties (generate script for client side instance) and read submitted info

Similar Threads

  1. [CLOSED] Razor syntax inside Ext Controls
    By mcfromero in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 08, 2012, 7:29 PM
  2. [CLOSED] [Razor] FormPanel and FileUpload?
    By Timothy in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: May 08, 2012, 12:44 PM
  3. [CLOSED] Razor Controls Visible
    By Timothy in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: May 05, 2012, 3:17 AM
  4. Replies: 0
    Last Post: Nov 17, 2011, 10:53 AM
  5. Replies: 2
    Last Post: Mar 22, 2011, 4:33 PM

Tags for this Thread

Posting Permissions