ghx88

GridView技巧收集

1.高亮显示GridView当前行
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    
{
            
if (e.Row.RowType == DataControlRowType.DataRow)
     
{
                 e.Row.Attributes.Add(
"onmouseover""this.style.backgroundColor='yellow',this.style.fontWeight='bold'");
                 e.Row.Attributes.Add(
"onmouseout""this.style.backgroundColor='white',this.style.fontWeight=''");
             }
       
}


    /// <summary>
    
/// 使GridView实现onMouseOver加亮的方法,需要将方法加在RowDataBound事件中。
    
/// </summary>
    
/// <param name="e">GridViewRowEventArgs</param>

    public static void GridViewStyle(GridViewRowEventArgs e) 
    
{
        
if (e.Row.RowType == DataControlRowType.DataRow)
        
{
            e.Row.Attributes.Add(
"onmouseover""this.className='tdbgmouseover'");
            e.Row.Attributes.Add(
"onmouseout""this.className='tdbg'");
        }

    }

posted on 2006-05-16 10:06  ghx88  阅读(225)  评论(0编辑  收藏  举报

导航