Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hyperlink Column

0 views
Skip to first unread message

Mike Schumacher

unread,
Feb 6, 2002, 4:30:29 PM2/6/02
to
I accidently sent this to the wrong news group so I apologize if this is the
second time you see it:

I have a hyper link colum in a datagrid:

<asp:HyperLinkColumn Text="Edit" DataNavigateUrlField="revision_id"
DataNavigateUrlFormatString="history_edit.aspx?rid={0}&tnbr="></asp:HyperLin
kColumn>

At the end I would like to add another parameter into the URL that is built.
As you can see there is a tnbr that I would like to add another parameter to
like the rhid={0}.

2 questions:

1. If I wanted to make it so that another parameter came from another
datafield (somehting like &tnbr={1}) Where would I put the other datafield
name so that I could refer to it as {1}?

2. How would I place a different value that is not from a data field. Like
if I wanted to place a value from somewhere else like the querystring.
Example: &tnbr=<%Response.Write("Request.Querystring("tnbr"))%> ( I realize
this won't work, but I am looking for something that will do something like
this.)

Any ideas?


Stephen Estes

unread,
Feb 7, 2002, 8:57:24 AM2/7/02
to

You could handle the ItemDataBound event, which is invoked
for each row during data binding. Both the link control
and your data source are accessible from the event
arguments. You can set your link properties here.

>.
>

Greg Burns

unread,
Feb 21, 2002, 10:31:03 AM2/21/02
to
And here is the code to do it...

Protected Sub Item_Bound(ByVal sender As Object, ByVal e As
DataGridItemEventArgs) Handles dgMyTasks.ItemDataBound

If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem) Then

Dim hyperlink As System.Web.UI.WebControls.HyperLink =
CType(e.Item.Cells(0).Controls(0), System.Web.UI.WebControls.HyperLink)

hyperlink.NavigateUrl = "status.aspx?id=" & e.Item.DataItem(0) & "&type=" &
e.Item.DataItem(1)

End If

End Sub

"Stephen Estes" <ses...@txucom.net> wrote in message
news:117001c1afdf$5e892aa0$35ef2ecf@TKMSFTNGXA11...

0 new messages