VBdotnet2005
asked on
DevExpress Gridview - Hyperlink colum
I am bindind Devexpress Gridview from code behind. I want to turn one column named 'tracking_number" into hyperlink. When a user click it, I want it to redirect to a page with tracking. This is what I have so far.
Imports System.Data.SqlClient
Imports System.Data
Imports System.Web.Configuration
Imports DevExpress.Web.ASPxGridView
Public Class sp_amp_sales_Main_Demo
Inherits System.Web.UI.Page
Private Sub Test_01_Init(sender As Object, e As System.EventArgs) Handles Me.Init
ASPxGridView1.DataSource = Session("grid1")
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Session.Remove("grid1")
If Page.IsPostBack = True Then
Session("grid1") = ASPxGridView1.DataSource
ASPxGridView1.DataBind()
End If
End Sub
Public Sub BindGrid()
Try
Session("grid1") = getData(ASPxTextBox_userid.Text.Trim)
ASPxGridView1.DataSource = Session("grid1")
ASPxGridView1.DataBind()
ApplyLayout(0)
Catch ex As Exception
End Try
End Sub
Public Function getData(ByVal userid As String) As DataSet
Dim sqlCon As New SqlConnection(ConfigurationManager.ConnectionStrings("myconn").ConnectionString)
Dim ds As New DataSet
Dim sqlComm As New SqlCommand("sp_sample01", sqlCon)
sqlComm.CommandType = CommandType.StoredProcedure
sqlComm.Parameters.AddWithValue("@UserID", userid)
Dim sqlApt As New SqlDataAdapter(sqlComm)
sqlCon.Open()
sqlApt.Fill(ds)
Return ds
End Function
Private Sub ApplyLayout(ByVal layoutIndex As Integer)
ASPxGridView1.BeginUpdate()
Try
ASPxGridView1.ClearSort()
Select Case layoutIndex
Case 0
ASPxGridView1.GroupBy(ASPxGridView1.Columns(0))
'Case 7
' ASPxGridView1.GroupBy(ASPxGridView1.Columns(7))
End Select
Finally
ASPxGridView1.EndUpdate()
End Try
ASPxGridView1.ExpandAll()
End Sub
Private Sub ASPxButton1_Click(sender As Object, e As System.EventArgs) Handles ASPxButton1.Click
Call BindGrid()
End Sub
Grid.gif
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER