FineUI 官方论坛
标题:
能否动态设置Grid的列的宽度?
[打印本页]
作者:
ccliushou
时间:
2015-6-21 22:17
标题:
能否动态设置Grid的列的宽度?
在线demo中有一个动态创建列的例子,该例子如何可以动态设置 列的宽度 呢??
FineUI
.
BoundField
bf
;
bf
=
new
FineUI
.
BoundField
();
bf
.
DataField
=
"Id"
;
bf
.
DataFormatString
=
"{0}"
;
bf
.
HeaderText
=
"编号"
;
Grid1
.
Columns
.
Add
(
bf
);
bf
=
new
FineUI
.
BoundField
();
bf
.
DataField
=
"Name"
;
bf
.
DataFormatString
=
"{0}"
;
bf
.
HeaderText
=
"姓名"
;
Grid1
.
Columns
.
Add
(
bf
);
bf
=
new
FineUI
.
BoundField
();
bf
.
DataField
=
"EntranceYear"
;
bf
.
DataFormatString
=
"{0}"
;
bf
.
HeaderText
=
"入学年份"
;
Grid1
.
Columns
.
Add
(
bf
);
bf
=
new
FineUI
.
BoundField
();
bf
.
DataToolTipField
=
"Major"
;
bf
.
DataField
=
"Major"
;
bf
.
DataFormatString
=
"{0}"
;
bf
.
HeaderText
=
"所学专业"
;
bf
.
ExpandUnusedSpace
=
true
;
Grid1
.
Columns
.
Add
(
bf
);
Grid1
.
DataKeyNames
=
new
string
[]
{
"Id"
,
"Name"
};
作者:
sanshi
时间:
2015-6-22 10:05
你不是都贴出来了么,直接设置 bf.Width 就行了
动态创建控件的常见问题:
http://www.cnblogs.com/sanshi/archive/2012/11/19/2776672.html
欢迎光临 FineUI 官方论坛 (https://fineui.com/bbs/)
Powered by Discuz! X3.4