会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
赖文华.NET
Anything is possible!(专注.NET,SAP FIOC,SAP ABAP) 一个人对于某个领域的理解,领会,实践,都有可能是片面的,沟通是最好的老师,可达到共同提高。
博客园
首页
新随笔
联系
管理
订阅
datagrid 动态添加自定义控件方法!
有很多朋友都在问这个怎么实现,今天把它给贴出来:
CODE
1
private
void
dgSGJB_ItemDataBound(
object
sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
2
{
3
//
判断只有数据项才添此控件。
4
if
( e.Item.ItemType
==
ListItemType.Item
||
e.Item.ItemType
==
ListItemType.AlternatingItem )
5
{
6
theSJDS
=
100
;
7
theLJCJDS
=
33
;
8
//
动态添加WEB自定义控件,生产进度比例条。
9
System.Web.UI.Control tempControl
=
this
.LoadControl(
"
../control/ProgressBar.ascx
"
);
10
ProgressBar rate
=
tempControl
as
ProgressBar;
11
12
rate.Value
=
((Convert.ToDouble(theLJCJDS)
/
Convert.ToDouble(theSJDS)))
*
100
;
13
rate.Prompt
=
"
总计划:4000,完成:3333
"
;
14
e.Item.Cells[
3
].Controls.Add( rate);
15
}
16
}
posted @
2008-01-20 18:51
赖文华.NET
阅读(
487
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告