Friday, 6 September 2013

Alternating row style with onmouseover and onmouseout

     <AlternatingRowStyle BackColor="AliceBlue" />

protected void grd_SearchQueryBuilder_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='silver'");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalstyle");
            e.Row.Attributes.Add("style", "cursor:pointer;");
        }
    }

No comments:

Post a Comment