PDA

View Full Version : [CLOSED] Portal Items Default Style



matrixwebtech
Nov 27, 2014, 10:35 AM
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)

)

Daniil
Nov 27, 2014, 6:24 PM
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).

matrixwebtech
Nov 27, 2014, 6:33 PM
Hi
Defaults is exists for Portal,but I am quite confused about syntax.It would be great if you give a 1 line sample.

Daniil
Nov 28, 2014, 3:04 PM
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?

matrixwebtech
Nov 28, 2014, 4:51 PM
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.
16691

Daniil
Dec 03, 2014, 1:43 PM
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.

matrixwebtech
Dec 03, 2014, 2:57 PM
hi daniil thanks for reply,this thread can be close I fix this with viewport and Region property.thanks again for help.