亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

asp.net GridView和DataList實現(xiàn)鼠標(biāo)移到行行變色

 更新時間:2009年02月12日 20:11:46   作者:  
在設(shè)計頁面添加了DataList控件后,我在使用DataList綁定數(shù)據(jù)時是通過單元格來綁定的,因此鼠標(biāo)效果就在源代碼頁面去實現(xiàn)
在GridView控件的RowDataBound事件里添加以下代碼
if (e.Row.RowType == DataControlRowType.DataRow)
{
//當(dāng)鼠標(biāo)移到行上時更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#EE82EE'");
//當(dāng)鼠標(biāo)移開時還原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
在設(shè)計頁面添加了DataList控件后,我在使用DataList綁定數(shù)據(jù)時是通過單元格來綁定的,因此鼠標(biāo)效果就在源代碼頁面去實現(xiàn),如下例所示
<asp:DataList ID="DataList1" runat="server" BorderWidth="1" >
<ItemTemplate>
<tr onmouseover="this.style.backgroundColor='#8EC26F'" onmouseout="this.style.backgroundColor=''" >
<td>
<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.ID") %>'></asp:Label>
</td>
<td>
<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Area") %>'></asp:Label>
</td>
</tr>
</ItemTemplate>
<HeaderTemplate>
Header1</td>
<td>Header2
</HeaderTemplate>
</asp:DataList>

相關(guān)文章

最新評論