Friday, November 19, 2010

asp.net css on gridview paging

In RowDatabound Event

if (e.Row.RowType == DataControlRowType.Pager)
        {
            TableRow tRow = e.Row.Controls[0].Controls[0].

            Controls[0] as TableRow;


            foreach (TableCell tCell in tRow.Cells)
            {


                Control ctrl = tCell.Controls[0];

                tCell.Attributes.Add("align", "center");
                if (ctrl is LinkButton)
                {


                    LinkButton lb = (LinkButton)ctrl;


                    lb.Width = Unit.Pixel(20);

                    //lb.Attributes.Add("");

                    lb.BackColor = System.Drawing.Color.DarkGray;


                    lb.ForeColor = System.Drawing.Color.White;


                    lb.Attributes.Add("onmouseover",


                       "this.style.backgroundColor='#4f6b72';");


                    lb.Attributes.Add("onmouseout",


                      "this.style.backgroundColor='darkgray';");


                }


            }



        }

No comments:

Post a Comment