GridView行褪色效果

时间:2011-02-07 19:39:14

标签: javascript jquery asp.net gridview

修改

这是我调试代码后在运行时生成的内容

<script type='text/javascript'>
$('#ctl00_ContentPlaceHolder1_tabControl_gv_ctl03').show().fadeIn(8000).fadeOut(90000)
</script>

是我正在寻找的......

enter image description here

在用行更新后,如何突出显示gridview控件行?

<asp:GridView runat="server" CssClass="DataWebControlStyle">    
<AlternatingRowStyle CssClass="AlternatingRowStyle" />   
 <RowStyle CssClass="RowStyle" />    <
HeaderStyle CssClass="HeaderStyle" />    
<SelectedRowStyle CssClass="SelectedRowStyle" />
</asp:GridView> 


protected void gv_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
   //update....
}

2 个答案:

答案 0 :(得分:1)

未经测试,但应该是这样的:

protected void gv_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    GridViewRow row = GridViewName.Rows[e.RowIndex];
    var sb = new StringBuilder();
    sb.Append(@"<script type='text/javascript'>");
    sb.Append(string.Format(@"$('#{0}').hide(200)", row.ClientId)); // hide or show here
    sb.Append(@"</script>");

    ScriptManager.RegisterStartupScript(GridViewName, this.GetType(), "showhide", sb.ToString(), false);
}

答案 1 :(得分:0)

protected void gv_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    GridViewRow row = GridViewName.Rows[e.RowIndex];
    row.CssClass = "some class that has background-color set";
}

只要您没有明确设置每个单元格的背景颜色,这应该(未经测试)工作。

注意:我意识到你指定了jQuery但是因为你发布了服务器端函数,我认为这更容易。