We help IT Professionals succeed at work.

DevExpress  Gridview - Hyperlink colum

VBdotnet2005
VBdotnet2005 asked
on
1,887 Views
Last Modified: 2014-09-29
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

Open in new window

Grid.gif
Comment
Watch Question

Author

Commented:
Any thoughts Experts?
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.