Hyperlink column in datagrid

J

Jos

ReidarT said:
I am trying to insert a hyperlink column in a datagrid
the field consist of a http://www.something.no/text.asp?id=FieldID
where FieldID is the field from the sql-server
I normally would have concatenated the text and the field
"http:\\www.something.no/text.asp?id=" & FieldID,
but I don't know how to "grab" the field in the propertybuilder of the
datagrid.

I'm afraid you can't do this in a hyperlink column.

I suggest converting the hyperlink column to a template
column, and using a databinding expression like this:

<a href="http://www.something.no/text.asp?id=<%#
Databinder.Eval(Container.dataItem,"FieldID")
%>">click here</a>
 
R

ReidarT

Thanks for your answer but this works fine now. If you use the property
builder and select the field in the URL field and the prefix in the URL
fromat string it works fine.
reidarT
 
S

Scott Mitchell [MVP]

Jos said:
I'm afraid you can't do this in a hyperlink column.

I suggest converting the hyperlink column to a template
column, and using a databinding expression like this:

<a href="http://www.something.no/text.asp?id=<%#
Databinder.Eval(Container.dataItem,"FieldID")
%>">click here</a>

You most certainly can have a HyperLinkColumn with a dynamic value in
the querystring. The downside of a HyperLinkColumn is that it only
allows *one* dynamic querystring value for the rendered hyperlink. If
you need two or more values in the querystring that are from the data
bound to the DataGrid, then you will have to use a TemplateColumn, as
you mention.

For more on the HyperLinkCoumn and hyperlinks in DataGrids, check out
the "Hyperlinks" FAQ section at http://datawebcontrols.com/faqs/




--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 
B

Bob the Builder

I have a tricky problem.

I have a datagrid with multiple rows. In each row, I have a column
that needs to display multiple hyperlinks.

In other words each row has an id, seq no. ship no and the potential
for one or many partcodes. Each part code when clicked needs to open a
new page based upon that part code.

I have many rows in the datagrid and each row is unique in that it can
have one or more than one part code.

Have any of you done this before?

I have tried many different ways and have come up empty. Any help
would be greatly appreciated.

BUZZMAN
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top