Grid奇偶行不同色应该怎么做? 不是有 alternativeitemstyle 和 itemstyle 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 alternativeitemstyle back color (1)<asp:datagrid id="datagrid1" AlternatingItemStyle-Backcolor="#000000" />(2)<asp:datagrid id="datagrid1"><alternatingitemstyle backcolor="#000000"/></asp:datagrid> 有问题呀,我在itemstyle中使用CSSCLASS定义一种样式又在alternatingitemstyle中定义了一种样式也是用CSSCLASS可是没有反应是为什么呢? <asp:datagrid id="d_info" OnItemDataBound="dg_bind".......>.cs--------------------------------------------------------public void dg_bind(object sender,DataGridItemEventArgs e) { if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='#0099FF',this.style.cursor='hand',this.style.ForeColor='white'"); }} or sorry:forget "onmouseout"please add:e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='white',this.style.cursor='hand'"); 第1个问题用alternatingitemstyle 的backcolor和itemstyle的backcolor即可;第2个问题可用javascript使用,也可在datagrid的itembound事件中使用{if((e.item.itemstyle==ListItemType.Item)||(e.item.itemstyle==ListItemType.AlternatingItem)){e.item.Attributes["onmouseover"]="this.style.backgroundcolor='red',this.cursor='default';e.item.Attributes["onmouseout"]="this.style.backgroundcolor='blue',this.cursor='hand';}} 已知Datatable 如何生成3层的XML文件 推荐几本AJAX的书吧,过年送分!! IIS端口被占用怎么解决 发布一个WEB服务:天气预报.同时发布其WAP版本.做WAP网站的朋友顶一下 如何将用户输入在textbox中的超连接地址串换成链接 关于网址的显示 超级难题,求助高手:多级子标签的xml生成DataSet 动态生成的表格怎么判断有无选择某个CheckBox,怎么取出该行的其它内容 如何将Datagrid中的数据导出成.dbf文件? 本不该在CSDN上问,但这个问题唯CSDN的朋友可解 请问如何申明"命名空间"//在.vb的文件里 请朋友们来指点迷津,解决问题+200分。
<asp:datagrid id="datagrid1" AlternatingItemStyle-Backcolor="#000000" />
(2)
<asp:datagrid id="datagrid1">
<alternatingitemstyle backcolor="#000000"/></asp:datagrid>
又在alternatingitemstyle中定义了一种样式也是用CSSCLASS
可是没有反应是为什么呢?
<asp:datagrid id="d_info" OnItemDataBound="dg_bind".......>.cs
--------------------------------------------------------
public void dg_bind(object sender,DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='#0099FF',this.style.cursor='hand',this.style.ForeColor='white'");
}
}
forget "onmouseout"please add:e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='white',this.style.cursor='hand'");
第2个问题可用javascript使用,也可在datagrid的itembound事件中使用
{
if((e.item.itemstyle==ListItemType.Item)||(e.item.itemstyle==ListItemType.AlternatingItem))
{
e.item.Attributes["onmouseover"]="this.style.backgroundcolor='red',this.cursor='default';
e.item.Attributes["onmouseout"]="this.style.backgroundcolor='blue',this.cursor='hand';}
}