Wednesday, January 02, 2008

How to Add a URL column for a GridView in ASP.NET

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ds As DataSet = New DBClass().SelectQueryforData()
End Sub
Private Sub AddGrid(ByVal t As DataTable)
For Each c As DataColumn In t.Columns
If c.ColumnName = "PK_ID_Column" Then
Dim y As HyperLinkField
y = New HyperLinkField()
y.DataTextField = c.ColumnName
y.HeaderText = c.ColumnName
y.DataNavigateUrlFormatString = "~/YourUrl.aspx?q={0}"
y.DataNavigateUrlFields = New String() {c.ColumnName}
Dim x As BoundField
x = New BoundField()
x.DataField = c.ColumnName
x.HeaderText = c.ColumnName
End If
Me.GridView1.AutoGenerateColumns = False
Me.GridView1.DataSource = t
Me.GridView1.AlternatingRowStyle.BackColor = Drawing.Color.AliceBlue
End Sub

Enjoy IT!

Best Smartphones/tech of 2019

So I was looking for the best tech of 2019. Here it goes: New Pixel 3 XL Google - Pixel 3 XL with 64GB Memory Cell Phone (Unlocked) - ...