HighTechTalks DotNet Forums  

Problem with Hyperlink in GridView

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss Problem with Hyperlink in GridView in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Tor Inge Rislaa
 
Posts: n/a

Default Problem with Hyperlink in GridView - 12-19-2007 , 04:07 PM






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



Reply With Quote
  #2  
Old   
Mohamad Elarabi
 
Posts: n/a

Default RE: Problem with Hyperlink in GridView - 12-19-2007 , 10:01 PM






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:

Quote:
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




Reply With Quote
  #3  
Old   
Tor Inge Rislaa
 
Posts: n/a

Default Re: Problem with Hyperlink in GridView - 12-20-2007 , 03:07 PM



Thanks a lot, just what I needed.

Regards
TIRislaa



"Mohamad Elarabi" <MohamadElarabi (AT) discussions (DOT) microsoft.com> skrev i melding
news:E1F0054A-8E64-4CB6-8E6F-898056F44CC4 (AT) microsoft (DOT) com...
Quote:
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






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.