Pages

Tuesday, October 26, 2010

Create Programmatically GridView Paging Style

Today, I am here to share with you a very useful technique of gridview paging style programmatically using vb.net shown below:

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)

If e.Row.RowType = DataControlRowType.Pager Then
Dim tRow As TableRow = TryCast(e.Row.Controls(0).Controls(0).Controls(0), TableRow)
For Each tCell As TableCell In tRow.Cells
Dim ctrl As Control = tCell.Controls(0)
If TypeOf ctrl Is LinkButton Then
Dim lb As LinkButton = CType(ctrl, LinkButton)
lb.Width = Unit.Pixel(15)
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';")
End If
Next tCell
End If

End Sub

3 comments:

  1. you are most welcome.....
    do not forget to mentioned whether it is interesting or cool. also, you can share it onto fb or many other network websites.
    thank you!

    ReplyDelete
  2. postingan yang bagus tentang Create Programmatically GridView Paging Style

    ReplyDelete