troubleshooting Question

DevExpress  Gridview - Hyperlink colum

Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America asked on
ASP.NETC#Visual Basic.NET
2 Comments1 Solution1897 ViewsLast Modified:
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
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros