Change DataNavigateUrlField dynamically

A

Alejandro K.

Hi guys, let's see if someone can give me a small hand with this....

i'm populating a dataset that sometimes changes 1 or 2 columns depending on
the querystring... i was trying to do something like this , but it doesn't
work...

<....DataNavigateUrlField= '<%# "Game" & request.querystring.item
(0).tostring %>"'....>

Any ideas how can i acomplish something like this???

Thanks.
Alex.
 
E

Elton Wang

You can set it in dataGrid_ItemDataBound Event

Suppose the hyperlink field is the first field, you can
use following code:

switch (e.Item.ItemType)
{
case ListItemType.Header:
case ListItemType.Separator:
case ListItemType.Footer:
return;
}

TableCell linkCell = (TableCell)e.Item.Controls[0];
HyperLink link = (HyperLink)linkCell.Controls[0];
link.NavigateUrl = Url;

Hope its helpful to you.

Elton Wang

(e-mail address removed)
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top