我的datalist这样写
<asp:datalist cellspacing="1" bgcolor="#CCCCCC" id="Dafo" DataKeyField="id" Runat="server"
Width="500" >
<HeaderStyle HorizontalAlign="Center" BackColor="#ffff99"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" BackColor="#FFFFFF"></ItemStyle>
<AlternatingItemStyle BackColor=#cccccc></AlternatingItemStyle>
<headertemplate>
<FONT color="#000000">ID</FONT></TD>
<TD align="center" bgcolor="#ffff99" width="27%">
<FONT color="#000000">图片</FONT></TD>
<TD bgcolor="#ffff99" width="16%" align="center">
<FONT color="#000000">类别</FONT></TD>
<TD bgcolor="#ffff99" width="24%" align="center">
<FONT color="#000000">上传时间</FONT></TD>
<TD bgcolor="#ffff99" width="20%" align="center">
<FONT color="#000000">删除</FONT>
</headertemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "id") %>
</td>
<td align="center" bgcolor="#FFFFFF">
<%# DataBinder.Eval(Container.DataItem, "newsname") %>
</td>
<td align="center" bgcolor="#FFFFFF">
<%# DataBinder.Eval(Container.DataItem, "newsclass") %>
</td>
<td align="center" bgcolor="#FFFFFF">
<%# DataBinder.Eval(Container.DataItem, "newstime","{0:D}") %>
</td>
<td align="center" bgcolor="#FFFFFF">
<asp:LinkButton ID="lbu" Runat="server" Text="删除" CommandName="Delete"></asp:LinkButton>
</ItemTemplate>
<AlternatingItemTemplate >
<%# DataBinder.Eval(Container.DataItem, "id") %>
</td>
<td align="center" >
<%# DataBinder.Eval(Container.DataItem, "newsname") %>
</td>
<td align="center" >
<%# DataBinder.Eval(Container.DataItem, "newsclass") %>
</td>
<td align="center">
<%# DataBinder.Eval(Container.DataItem, "newstime","{0:D}") %>
</td>
<td align="center" >
<asp:LinkButton ID="Linkbutton1" Runat="server" Text="删除" CommandName="Delete"></asp:LinkButton>
</AlternatingItemTemplate>
</asp:datalist>
在后台这样写private void DataGridLogininfo_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
ListItemType itemType = e.Item.ItemType;
if (itemType == ListItemType.Item )
{
e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#dedfde';";
e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ; }
else if( itemType == ListItemType.AlternatingItem)
{
e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#ffffff';";
e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ;
}
}但是无法实现鼠标经过颜色替换问题出在什么地方?该如何写????
<asp:datalist cellspacing="1" bgcolor="#CCCCCC" id="Dafo" DataKeyField="id" Runat="server"
Width="500" >
<HeaderStyle HorizontalAlign="Center" BackColor="#ffff99"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" BackColor="#FFFFFF"></ItemStyle>
<AlternatingItemStyle BackColor=#cccccc></AlternatingItemStyle>
<headertemplate>
<FONT color="#000000">ID</FONT></TD>
<TD align="center" bgcolor="#ffff99" width="27%">
<FONT color="#000000">图片</FONT></TD>
<TD bgcolor="#ffff99" width="16%" align="center">
<FONT color="#000000">类别</FONT></TD>
<TD bgcolor="#ffff99" width="24%" align="center">
<FONT color="#000000">上传时间</FONT></TD>
<TD bgcolor="#ffff99" width="20%" align="center">
<FONT color="#000000">删除</FONT>
</headertemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "id") %>
</td>
<td align="center" bgcolor="#FFFFFF">
<%# DataBinder.Eval(Container.DataItem, "newsname") %>
</td>
<td align="center" bgcolor="#FFFFFF">
<%# DataBinder.Eval(Container.DataItem, "newsclass") %>
</td>
<td align="center" bgcolor="#FFFFFF">
<%# DataBinder.Eval(Container.DataItem, "newstime","{0:D}") %>
</td>
<td align="center" bgcolor="#FFFFFF">
<asp:LinkButton ID="lbu" Runat="server" Text="删除" CommandName="Delete"></asp:LinkButton>
</ItemTemplate>
<AlternatingItemTemplate >
<%# DataBinder.Eval(Container.DataItem, "id") %>
</td>
<td align="center" >
<%# DataBinder.Eval(Container.DataItem, "newsname") %>
</td>
<td align="center" >
<%# DataBinder.Eval(Container.DataItem, "newsclass") %>
</td>
<td align="center">
<%# DataBinder.Eval(Container.DataItem, "newstime","{0:D}") %>
</td>
<td align="center" >
<asp:LinkButton ID="Linkbutton1" Runat="server" Text="删除" CommandName="Delete"></asp:LinkButton>
</AlternatingItemTemplate>
</asp:datalist>
在后台这样写private void DataGridLogininfo_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
ListItemType itemType = e.Item.ItemType;
if (itemType == ListItemType.Item )
{
e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#dedfde';";
e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ; }
else if( itemType == ListItemType.AlternatingItem)
{
e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#ffffff';";
e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ;
}
}但是无法实现鼠标经过颜色替换问题出在什么地方?该如何写????
解决方案 »
- 问个小问题(关于兼容IE和Firefox)获取复选框值的问题
- C#做网站,网页中有个表,怎么插入word
- 寻.net强人——关于用户控件属性
- asp.net3.5中css+div的问题
- 面象对象时,数据库不能保存“对象”而只能保存“对象编号”,那请问如何完美的将数据库中的“对象编号”与逻辑中使用的“对象”关联起来?
- 为什么我的程序在调试运行时显示:Error while trying to run project:Unableto start debugging on the web server.
- 网站测试不成功,跪求大家帮忙!
- 把网站上传到空间上,重新引用DLL,可是对方公司说DLL文件他们给注册,一百元一个。
- 请高手来帮我解释一下以下现象的产生原因。
- textbox的textchanged和button的click事件冲突
- Response.Redirect前如何清空所有空间的属性信息?
- 请问怎样使用XenoCode 2004来混淆工程的DLL!
属于笔误。其他的都对
为什么不好使哪?