469,902 Members | 1,976 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,902 developers. It's quick & easy.

Problem with Hyperlink in GridView

When I insert the complete querystring into the NavigateUrl tag this
hyperlink works fine within the GridView.

<asp:HyperLinkField HeaderText=" Details"
NavigateUrl="~/Admindetail.aspx?ku_id=1" Text="Details"

If I try to let the parameter data be provided dynamically something strange
happen. I can see that the dynamical data is provided, with the right ku_id,
but the aspx file is removed from the URL

<asp:HyperLinkField DataNavigateUrlFields="ku_id" HeaderText="Details"
NavigateUrl="~/Admindetail.aspx?ku_id={0}" Text="Details" />

The first code gives something like

www.mysite.com/Admindetail.aspx?ku_id=1

this works OK

The second code gives something like

www.mysite.com/1

Am I configuring it incorrect?

TIRislaa
Dec 19 '07 #1
2 4896
Tor,
the NavigateURL is only used when specifying the same link for all rows.
Text attribute is also static accreoss the board. If you want the link to
include a value from a data field you should use the DataNavigateURLField
with the DataNavigateURLFormatString. The same goes for DataTextField and
DataTextFormatString if you want the link text to also be dynamic. Your tag
should look something like this

<asp:HyperLinkColumn
HeaderText="View Detail"
DataNavigateUrlField="ku_id"
DataNavigateUrlFormatString="~/Admindetail.aspx?ku_id={0}"
DataTextField="ku_id"
DataTextFormatString="Details for Record {0}" />

Good luck,

--
Mohamad Elarabi
Lead Developer. MCTS, MCPD.
"Tor Inge Rislaa" wrote:
When I insert the complete querystring into the NavigateUrl tag this
hyperlink works fine within the GridView.

<asp:HyperLinkField HeaderText=" Details"
NavigateUrl="~/Admindetail.aspx?ku_id=1" Text="Details"

If I try to let the parameter data be provided dynamically something strange
happen. I can see that the dynamical data is provided, with the right ku_id,
but the aspx file is removed from the URL

<asp:HyperLinkField DataNavigateUrlFields="ku_id" HeaderText="Details"
NavigateUrl="~/Admindetail.aspx?ku_id={0}" Text="Details" />

The first code gives something like

www.mysite.com/Admindetail.aspx?ku_id=1

this works OK

The second code gives something like

www.mysite.com/1

Am I configuring it incorrect?

TIRislaa
Dec 20 '07 #2
Thanks a lot, just what I needed.

Regards
TIRislaa

"Mohamad Elarabi" <Mo************@discussions.microsoft.comskrev i melding
news:E1**********************************@microsof t.com...
Tor,
the NavigateURL is only used when specifying the same link for all
rows.
Text attribute is also static accreoss the board. If you want the link to
include a value from a data field you should use the DataNavigateURLField
with the DataNavigateURLFormatString. The same goes for DataTextField and
DataTextFormatString if you want the link text to also be dynamic. Your
tag
should look something like this

<asp:HyperLinkColumn
HeaderText="View Detail"
DataNavigateUrlField="ku_id"
DataNavigateUrlFormatString="~/Admindetail.aspx?ku_id={0}"
DataTextField="ku_id"
DataTextFormatString="Details for Record {0}" />

Good luck,

--
Mohamad Elarabi
Lead Developer. MCTS, MCPD.
"Tor Inge Rislaa" wrote:
>When I insert the complete querystring into the NavigateUrl tag this
hyperlink works fine within the GridView.

<asp:HyperLinkField HeaderText=" Details"
NavigateUrl="~/Admindetail.aspx?ku_id=1" Text="Details"

If I try to let the parameter data be provided dynamically something
strange
happen. I can see that the dynamical data is provided, with the right
ku_id,
but the aspx file is removed from the URL

<asp:HyperLinkField DataNavigateUrlFields="ku_id" HeaderText="Details"
NavigateUrl="~/Admindetail.aspx?ku_id={0}" Text="Details" />

The first code gives something like

www.mysite.com/Admindetail.aspx?ku_id=1

this works OK

The second code gives something like

www.mysite.com/1

Am I configuring it incorrect?

TIRislaa

Dec 20 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by bill tie | last post: by
2 posts views Thread by Loading name... | last post: by
3 posts views Thread by Jeff | last post: by
3 posts views Thread by Jeff | last post: by
1 post views Thread by Jeff | last post: by
1 post views Thread by Jeff | last post: by
reply views Thread by =?Utf-8?B?UmF5bmFsZA==?= | last post: by
1 post views Thread by siri11 | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.