Need help with Hyperlink Column in DataGrid!

J

Jack Black

Hi, all!

I'm trying to build a hyperlink column in a DataGrid whose textField
is one column in the query, but whose URL needs to dynamically contain
the data from another.

For example, I want to display a book title (column = "Title"), but
the URL needs to be:
myPage.aspx?book=ISBN (where ISBN is a column name)

I'm building this with the designer, and not by manually writing out
the DataGrid and HyperLinkColumn tags. I've tried setting the URL
properties in the designer to a number of different things, but I only
get either the data column ALONE in place of the URL, or it isn't
processing the {0} portion of the URL (presumably this is an index
value, but since I can't find a single shred of documentation on this
convention, I'm guessing here)...

Tried a few different approaches, but can't get there... Suggestions?

Jack
 
H

Hermit Dave

set the column as template column... and then add hyperlink
for the navigate url.. use
navigateURL = '<%# "myPage.aspx?book=" + DataBind(Container.DataItem,
"columnname") %>'
something like that

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 
J

Jack Black

Dave, thanks for responding! I tried that, and it still didn't work.
For some bizarre reason, using the "{0} nomenclature in the
URLFormatString property magically started working, after not having
worked all afternoon. Go figure. 8-|

Thanks again for the tip! I'll probably try to get your suggestion to
work anyway so I have other options in the ol' toolbag! :)

Jack
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top