文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Gridview行根据鼠标的移动变色

Gridview行根据鼠标的移动变色

时间:2011-02-25  来源:hfliyi

后台代码
 1  protected void Page_Load(object sender, EventArgs e)
2 {
3 if (!IsPostBack)
4 {
5 databind();
6 }
7 }
8 public void databind()
9 {
10 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ToString());
11 SqlCommand cmd = new SqlCommand();
12 cmd.Connection = con;
13 cmd.CommandText = "Select top 10 * From Customers";
14 SqlDataAdapter da = new SqlDataAdapter(cmd);
15 DataSet ds = new DataSet();
16 da.Fill(ds);
17 this.GridView1.DataSource = ds.Tables[0];
18 this.GridView1.DataKeyNames = new string[] { "CustomerID" };
19 this.GridView1.DataBind();
20 }
21 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
22 {
23 if (e.Row.RowType == DataControlRowType.DataRow)
24 {
25 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#ff9900'");
26 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
27
28 }
29 if (e.Row.RowType == DataControlRowType.Header)
30 {
31 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#ff6600'");
32 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
33 }
34
35 }
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载