[CLOSED] Portal Items Default Style

  1. #1

    [CLOSED] Portal Items Default Style

    How to set default style for items placed inside Portal?I want to set a style for all item inside the portal,maybe labelwidth,field width label align etc.
     X.Portal().Border(false).BodyStyle("background-color:#D3E1F2").Layout(LayoutType.HBox)
                  
                   .Items
                   (
    
                        X.ComboBox()
                        .ID("BranchID")
                        .FieldLabel("Branch")
                        .AnchorHorizontal("100%")
                        .LabelAlign(LabelAlign.Left)
                       
       
                        ,
                        X.ComboBox()
                        .ID("cmbDepartment")
                        .FieldLabel("Department")
                        .AnchorHorizontal("100%")
                        ,
                        X.ComboBox().ID("PaygroupID")
                        .Editable(false)
    
                        .FieldLabel("Pay group")
                        .AnchorHorizontal("100%")
                        .LabelAlign(LabelAlign.Left)
      
    )
    Last edited by Daniil; Dec 03, 2014 at 2:16 PM. Reason: [CLOSED]
  2. #2
    Hi @matrixwebtech,

    To set some default settings for a container's children, you could try to use a container's Defaults and/or FieldDefaults (if exists for the container type that you've choosen).
  3. #3
    Hi
    Defaults is exists for Portal,but I am quite confused about syntax.It would be great if you give a 1 line sample.
  4. #4
    Example
    @(X.Container()
        .Defaults(new
        {
            labelAlign = "top",
            width = 250
        })
        .Items(
            X.TextField().FieldLabel("TextField 1"),
            X.TextField().FieldLabel("TextField 2")
        )
    )
    By the way, I don't think a Portal component is supposed to have non-PortalColumn Items, as here:
    http://mvc.ext.net/#/Portal/Simple/

    Could you, please, clarify why do you use a Portal with fields in Items?
  5. #5
    Hi daniil

    @{
       
       var X = Html.X();
       
    }
    
    @X.ResourceManager()
     @(Html.X().Viewport()
           
                    .Layout(LayoutType.Fit)
                    .Border(false)
                .Items(
            Html.X().TabPanel()
            .ID("TabPanel1")
            .Layout(LayoutType.Fit)
            .Border(false)
            .Items
            (
    
                       X.Panel().Title("Title").Border(false).BodyStyle("background-color:#D3E1F2")//.Layout(LayoutType.VBox)
               .Items
               (
                    X.Portal().Border(false).BodyStyle("background-color:#D3E1F2").Layout(LayoutType.HBox)
                        
                   .Items
                   (
                  
                        X.ComboBox()
    
                                        .FieldLabel("ComboBox 0")
                                        .AnchorHorizontal("100%")
                                        
                                        
                                                        ,
    
    
            //------ Field Position : Row[3].Column[2]------
            //------- Table Name :tbl_PM_Project_SiteInformation  ----
                                        X.ComboBox()
                                        .ID("cmbDepartment")
                                        .FieldLabel("ComboBox 1")
    
                                                 ,
    
                                     X.ComboBox()
    
                                        .Editable(false)
                                        .FieldLabel("ComboBox 2")
                                                        ,
    
    
                                     X.TextField()
                                    .ID("txtEmployeecode")
                                    .FieldLabel("TextField 1")
                                    ,
    
    
                                    X.TextField()
                                .ID("txtEmployeename")
                                .FieldLabel("TextField 2")
                                ,
                             X.Button()
                                .ID("btnGenarate")
                                .Text("Genarate")
                                .Icon(Icon.ReverseGreen)
                                   
    
                                )
                                
    
                                ,
    
    
    
                                                X.Panel().ID("container").Layout(LayoutType.Fit).Border(false).BodyStyle("background-color:#D3E1F2")
                                            .Padding(10)
                                           
                                           
    
    
                )
    
    
    
            )
           
            )
    
            )
    this is my design with Portal which is render fine with all screen resolution.I attach a screen shot with Panel instead of Portal.in 1366X768 all controls are not visible.thats why I use Portal.but I not able to fix the Generate button's width.
    Click image for larger version. 

Name:	Panel-1366X768.png 
Views:	11 
Size:	18.0 KB 
ID:	16691
  6. #6
    A Portal uses a ColumnLayout internally and it ignores a Layout setting. So, your Portal ignores
    .Layout(LayoutType.HBox)
    A Panel doesn't ignore this setting.

    I think it is the main reason of the difference in the behaviors that you see with a Panel and a Portal.

    I would still recommend you to use a Panel instead of a Portal. You just need to provide it with a proper layout. If a Portal is OK for you, then you should use a ColumnLayout. Personally I would probably prefer an HBoxLayout. Though, I don't know your requirements for sure.

    but I not able to fix the Generate button's width.
    Sorry, I don't quite understand what you mean.
  7. #7
    hi daniil thanks for reply,this thread can be close I fix this with viewport and Region property.thanks again for help.

Similar Threads

  1. [CLOSED] Element got style="width:0px;" default
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Feb 04, 2013, 1:30 PM
  2. Replies: 5
    Last Post: Jun 22, 2012, 2:47 PM
  3. Replies: 0
    Last Post: Sep 27, 2011, 10:24 AM
  4. [CLOSED] [1.0] MVC ext:Portal Items Error
    By bbo1971 in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 03, 2010, 1:39 PM
  5. [CLOSED] [1.0]Moving Portlet from Portal to Portal
    By betamax in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 21, 2010, 11:47 AM

Posting Permissions