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

Hyperlink Columns

0 views
Skip to first unread message

Brent Stevenson

unread,
Mar 14, 2002, 10:36:30 AM3/14/02
to
I have a DataGrid that is populated with a column of data returned from a
stored procedure. I have defined this column as a "HyperLink Column",
configured the "URL field" (as "prodcode" as this is the name of the value
defined in the stored procedure) & "URL Format String" fields so they pass
the columns value to a target page (TargetPage.aspx?prodcode={0}). This
works great & I can retrieve the value by using this syntax in the
TargetPage:
Request.QueryString("prodcode")

However want I want to do is pass a different column's values (also returned
by the stored procedure) to the Target Page when the user selects
the defined Hyperlink column. So display one value (this is an abbreviated
description) but pass a string of key values that corresponed to the
abbreviated description.

Can this be done using the DataGrids Hyperlink Column Property? If not how
else can it be done?

Thanks Brent


Jim Ross [MVP]

unread,
Mar 14, 2002, 12:59:03 PM3/14/02
to
I am doing this by binding the URLFormatString to a function in the
code-behind that takes "Container.Dataitem" as a parameter and returns
the formatted strong.


"Brent Stevenson" <stev...@admworld.com> wrote:

Jim Ross
MS MVP [VC/MFC]

To send email, change 'lotsofspamthroughhere' to 'msn' but please ask all questions in the newsgroups, not via private mail

Brent Stevenson

unread,
Mar 14, 2002, 1:48:04 PM3/14/02
to
Thanks Jim for the info. Do you have an example?

Thanks Brent

"Jim Ross [MVP]" <ro...@lotsofspamthroughhere.com> wrote in message
news:d4p19u8pvdh6helt6...@4ax.com...

Jim Ross [MVP]

unread,
Mar 14, 2002, 4:00:45 PM3/14/02
to
I'm typing this online, so no guarantees on syntax:

In the aspx:
<asp:hyperlink
urlformatstring='<%# BuildURLString(Container.Dataitem)%>' />

In the codebehind: [I may not have the type exactly correct on the
input parm here]

Protected Function BuildURLString(row As DataRow) As string
' code to get values from the datarow and build the string
' might look something like
Dim retval as String
retval = "myTarget.aspx?ID="
retval += row("RecID").ToString
retval += "&Parms="
retval += other junk from the DataRow
return retval
End Function

Does this help?

"Brent Stevenson" <stev...@admworld.com> wrote:

>Thanks Jim for the info. Do you have an example?
>

>"Jim Ross [MVP]" <ro...@lotsofspamthroughhere.com> wrote in message
>news:d4p19u8pvdh6helt6...@4ax.com...
>> I am doing this by binding the URLFormatString to a function in the
>> code-behind that takes "Container.Dataitem" as a parameter and returns
>> the formatted strong.
>>

Jim Ross

0 new messages