gridview行背景色切换 [英] gridview row backcolor toggle

查看:80
本文介绍了gridview行背景色切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {


if (e.Row.RowType == DataControlRowType.DataRow)
        { 
e.Row.Attributes.Add("onclick", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#FFFF00'");
}
}



如何在不使用onclick的情况下不使用javascript的情况下切换背景色.



how to toggle the backcolor without using javascript by onclick...

推荐答案

在没有回发以重新绘制行的情况下,无法进行切换. JavaScript将是最快,最人性化和高性能的方式.为什么不使用它?
There is no way to toggle this without a postback to redrawn the rows. JavaScript would be the fastest, most user friendly and performant way. Why not use it?


这篇关于gridview行背景色切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆