Dynamic DataGrid Hyperlink column

A

Adam Getz

Is there a way to dynamically set the field DataNavigateUrlFormatString in a
hyperlink column of a datagrid? Currently, if a user clicks on the
hyperlink in the hyperlink column for every record in the grid, they are
always directed to the same url. This is because the
DataNavigateUrlFormatString value is the same for all rows in the datagrid.

I would like a different Url based upon values in the datagrid. For
example, I have a column called Type in my datagrid. Based upon this value,
I would like the user to be redircted to an appropriate URL when the click
on a hyperlink. Can the DataNavigateUrlFormatString value be modified
dynamically to handle this situation?

Adam Getz
 
D

Daniel Bass

Yep,

for some table that looks like this say

Type Moves ID
pawn forward one space 1234
king anywhere once space 1235
queen anywhere at once 1236

with type as your hyperlink column...

set the URL on it to soemthing like, "detailsOnChess.aspx?Type={0}"
whihc looks at the {x} and takes that columns reference for that pressed row
and sends in the data to that URL to produce something like
"detailsOnChess.aspx?Type=king" for that instance where the king cell is
pressed.

"Type" would be {0} and "moves" {1} and so on, i assume...

Dan.
 
D

Daniel Bass

In that case i'd not use the hyperlink column at all, but the button
column...

you can then set the command to "select" so that you can then handle the on
change selection event.

from here you can get the selected data, say your email type, then in the vb
code decide which URL you want to go to before calling a transfer on the
server object.

if you need any code examples of what i'm talking about lemme know.
 

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