Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Add Hyperlink column at runtime

Reply
Thread Tools

Add Hyperlink column at runtime

 
 
Scott Friedrich
Guest
Posts: n/a
 
      12-28-2004
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



 
Reply With Quote
 
 
 
 
Scott Friedrich
Guest
Posts: n/a
 
      12-29-2004
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





"Scott Friedrich" <Scott http://www.velocityreviews.com/forums/(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gridview column values to another page via gridview hyperlink column Keith G Hicks ASP .Net 3 02-18-2008 06:17 AM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink davetichenor ASP .Net 1 10-30-2006 02:57 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink Dave ASP .Net Datagrid Control 0 10-21-2006 07:48 PM
How to assign a column of URLs to Hyperlink Column of a DataGrid c =?Utf-8?B?ZGF2aWQ=?= ASP .Net 11 07-17-2006 07:20 PM
HyperLink Column and Button Column in a DataGrid =?Utf-8?B?V2FyYW4=?= ASP .Net 0 08-09-2005 12:00 AM



Advertisments