insert a hyperlink column to datgrid

T

TJS

how can I programmatically insert an optional hyperlink column into my
datagrid which is currently being created from design tags

I am trying example found as below but with no success. what am I missing?


==============code====================
.... create dataset ...

MyDataGrid.AutoGenerateColumns = false

if condition = true then
' Add a hyperlink column
Dim hc1 as new HyperLinkColumn
hc1.DataTextField = "StringValue"
hc1.DataTextFormatString = "Show details for {0}"
hc1.DataNavigateUrlField="IntegerValue"
hc1.DataNavigateUrlFormatString="details.aspx?ID={0}"
hc1.HeaderText="Show me more"
MyDataGrid.Columns.Add (hc1)
end if

MyDataGrid.DataSource = ds
MyDataGrid.DataBind()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top