在我的Sharepoint WebPart(在我的.ascx.cs文件中)中,我有条件地以编程方式创建各种控件/元素,例如:
CheckBox ckbxEmployeeQ = new CheckBox
{
CssClass = "dplatypus-webform-field-input",
ID = "ckbxEmp"
};
ckbxEmployeeQ.Text = "Employee?";
ckbxEmployeeQ.Width = 80;
我希望能够设置MaxWidth属性,但它不能以这种方式使用:
CheckBox ckbxEmployeeQ = new CheckBox
{
CssClass = "dplatypus-webform-field-input",
ID = "ckbxEmp",
MaxLength = 12
};
......也不是这样:
CheckBox ckbxEmployeeQ = new CheckBox
{
CssClass = "dplatypus-webform-field-input",
ID = "ckbxEmp"
};
ckbxEmployeeQ.Text = "Employee?";
ckbxEmployeeQ.Width = 80;
ckbxEmployeeQ.Style.MaxLength = 12;
我怎样才能完成它?
boxSSNOrITIN = new TextBox
{
CssClass = "dplatypus-webform-field-input",
ID = "txtbxSSNOrITIN",
Width = 80,
MaxLength = 12
}