Add Hyperlink column at runtime

S

Scott Friedrich

I found this link in a previous thread:

http://datawebcontrols.com/faqs/

Thanks Scott Mitchell!!

That code works fine if I add the ASP code to the HTML page. What I have is
the need to set a column as a hyperlink in code at run time. I have a page
where a user can create ad hoc queries. I am determinig the datatype of the
column and if it is a hyperlink I then need to set the column in the datagrid
as a hyperlink. These queries will be different everytime and that is why I
need to dynamically set the hyperlink column(s) at run time.

Any advice greatly appreciated.

Scott Friedrich
 
S

Scott Friedrich

I figured it out. I needed to turn off AutoGenerateColumns and add them via
code..ala..

Dim col0 As New HyperLinkColumn

col0.DataTextField = dt.Columns(0).ColumnName

col0.DataNavigateUrlField = dt.Columns(0).ColumnName

col0.DataNavigateUrlFormatString = "Javascript: var w =
window.open('ViewImage.aspx?ID={0}','','width=600,height=400');"

col0.HeaderText = "URL"

Me.DataGrid1.Columns.Add(col0)

Scott
 

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,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top