hi how to give hyper link to inside of the gridview columns.........
here my code is given below but it was not working properly.....
please give me the correct code.........

Private Sub fillgrid()
            Dim Hyper_Column
            adp1 = New SqlDataAdapter(" select vendorcode , vendorname as 'Vendor_Name' from vendor_master", con)
            adp1.Fill(ds, "vendors")
            DataGrid1.DataSource = ds
            DataGrid1.DataBind()
            DataGrid1.Dispose()

            Hyper_Column = New HyperLinkColumn()
            Hyper_Column.HeaderText = "Vendor Code"
            Hyper_Column.DataNavigateUrlField = "vendorcode"
            Hyper_Column.DataNavigateUrlFormatString = "menu.aspx"
            Hyper_Column.DataTextField = "vendorcode"
            Hyper_Column.Target = "_self"
            DataGrid1.Columns.Add(Hyper_Column)

        End Sub

thank you
please help me.......

Recommended Answers

All 3 Replies

try do the same thing but move DataGrid1.DataBind() and DataGrid1.Dispose() to the last line of the method.

try do the same thing but move DataGrid1.DataBind() and DataGrid1.Dispose() to the last line of the method.

HI iam changes the modifications as you want,,,,,
but the problem again comes....

Private Sub fillgrid()
            Dim Hyper_Column
            adp1 = New SqlDataAdapter(" select vendorcode,vendorname as 'Vendor_Name' from vendor_master", con)
            adp1.Fill(ds, "vendors")
            DataGrid1.DataSource = ds
            DataGrid1.SelectedIndex.ToString()

            Hyper_Column = New HyperLinkColumn()
            Hyper_Column.DataTextField = "vendorcode"
            Hyper_Column.DataTextFormatString = ""
            'Hyper_Column.HeaderText = ""
            Hyper_Column.HeaderStyle.Font.Name = "Times New Roman"
            Hyper_Column.DataNavigateUrlField = "vendorcode"
            Hyper_Column.DataNavigateUrlFormatString = "menu.aspx?vendorcode"
            DataGrid1.Columns.Add(Hyper_Column)
            DataGrid1.DataBind()
            DataGrid1.Dispose()
            DataGrid1.AutoGenerateColumns = False

            DataGrid1.Columns(0).Visible = True


        End Sub

iam getting two vendorcode coloumns.......
i wants to get only one........
please give me the correct code....

Hey did you fix your problem? Sorry for the delay.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.