All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
技巧文章:UTF8下的中文PHP编程_php资料_编程技术
利用MD5加密数据库中的密码_[Asp.Net教程]
数据库连接URL中分号引发的错误_.net资料_编程技术
保护代码安全,PHP如何进行注入_[PHP教程]
添加数据集(DataSet)、数据表(DataTable)、行、列、主键和外键等操作示例代码_[Asp.Net教程]
ADO.NET链接数据库Command对象应用实例
MVC,3.0,在各个版本IIS中的部署_.net资料_编程技术
delphi高级vcl组件工具栏组件(TToolBar)使用实例
解决SqlTransaction用尽的问题(SQL处理超时)_[SQL,Server教程]
ASP.NET3.5的ListView与CSS,Friendly_.net资料_编程技术
Reading number is top 10 pictures
So beauty, will let you spray blood5
A beautiful girl to bud1
清醇靓丽的美眉
Nikon microscopic photography of the first three
青涩甜美-王祖贤小时候的旧照片曝光
壮丽的云彩2
徐若瑄展示美丽胸围2
A man's favorite things9
小学生作文又现神作,你不得不佩服
Forced sex girl living abroad2
Download software ranking
Unix video tutorial14
天龙八部十二宫服务端
艳兽都市
matrix2
The Bermuda triangle2
虚拟机5.5.3版
C#高级编程(第4版)
Prostitutes diary
Desire a peach blossom
中国结婚习俗实录
delv published in(发表于) 2014/1/6 9:06:42 Edit(编辑)
C#技巧:给datagrid的按钮列添加css_[Asp.Net教程]

C#技巧:给datagrid的按钮列添加css_[Asp.Net教程]

C#技巧:给datagrid的按钮列添加css_[Asp.Net教程]

今天改界面,发现datagrid可以用cssclass设置css风格,但是按钮列没有cssclass属性。忙活了半天,发现只能用程序设置按钮列属性。

  设置方法如下(C#版本)


  为datagrid添加ItemCreat事件,在ItemCreat事件里面添加如下代码


private void dgBoxList_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType== ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem )
{
Button myButton=(Button)e.Item.Cells[2].Controls[0];
//Cells[i].Controls[j] i为你的按钮列在datagrid的第几行,从0开始的,
//比如你的按钮列是第三行,则i为2,Controls[j],j为该列的第几个控件,默认一般是0。
myButton.CssClass = "button" ;//这里设置你为该按钮准备好的css

}
}


来源:网络







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.