Site Search

Thursday, June 30, 2011

How to remove Gridview sort column Header underline - for beginners(C#)

code behind:
Use fallowing method in RowDatabound Event.
RemoveHeaderUnderLine(e);
        private static void RemoveHeaderUnderLine(GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                for (int cell = 0; cell < e.Row.Cells.Count; cell++)
                {
                    if (e.Row.Cells[cell].Controls.Count > 0)
                    {
                        LinkButton Link = (LinkButton)e.Row.Cells[cell].Controls[0];
                        Link.Attributes.Add("style", "text-decoration:none;");
                    }
                }
            }
        }

No comments:

Post a Comment