Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Problem with Hyperlink in GridView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tor Inge Rislaa - 19 Dec 2007 21:07 GMT
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
Mohamad Elarabi - 20 Dec 2007 03:01 GMT
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,

Signature

Mohamad Elarabi
Lead Developer. MCTS, MCPD.

> When I insert the complete querystring into the NavigateUrl tag this
> hyperlink works fine within the GridView.
[quoted text clipped - 22 lines]
>
> TIRislaa
Tor Inge Rislaa - 20 Dec 2007 20:02 GMT
Thanks a lot, just what I needed.

Regards
TIRislaa

> Tor,
>    the NavigateURL is only used when specifying the same link for all
[quoted text clipped - 43 lines]
>>
>> TIRislaa

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.