Avatar of Ztrain2100
Ztrain2100

asked on 

How to reset hyperlinks in ASP.Net DataGrid

Hi there,

I have a VB.Net / ASP.Net datagrid that uses the DataGrid control to query a database to display records. The user can drill-down into another web page to display the full record. The problem is once the user clicks on the hyperlink, that hyperlink doesn't get reset within the grid no matter what the future search criteria is or when they use the "Next" / "Previous" buttons to move to other pages within the grid. So, it looks like they've drilled down on rows that they haven't actually drilled-down on. Is there any way to get around this? Even just resetting the state of the hyperlinks each time a page in the grid is displayed would be fine.

 Within the grid I use the following HTML to create the hyperlink

<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="" HeaderText="Details" CancelText="" EditText="Details" > </asp:EditCommandColumn>

The OnEditCommand of the grid is set to call a routine VB "DisplayRecord" which stores the primary key of the selected record in a Session variable and then does a Response.Redirect to go to the page which displays the details. The Detail page grabs the Session variable and uses that to query the database and get the record.

Any ideas, help, suggestions would be greatly appreciated! Please let me know if you need more information about the grid or the code.

Thanks,

Zack

.NET Programming

Avatar of undefined
Last Comment
Ztrain2100
Avatar of esteban_felipe
esteban_felipe

Hi Ztrain2100,

what do you mean with "that hyperlink doesn't get reset within the grid"? And why are you using a EditCommandColumn?.. it sounds to me that it should be a TemplateColumn

Esteban Felipe
www.estebanf.com
Avatar of Ztrain2100
Ztrain2100

ASKER

Sorry about the confusion. I meant the state of the hyperlink that the user clicked appears "visited" which if fine, but when they go to the next page of the grid, that same hyperlink shows as visited even though the user didn't actually click on it. I would like to reset the hyperlink to its "unvisited" state when they go to a new page.

I am open to suggestions on the method to use to display a hyperlink within a DataGrid, determine what row the user clicked on, and then redirect to another page which will then query the database for the record. The use of the EditCommandColumn came from an example in a .Net book I read that I modifed for my purposes. It allows a VB routine to be executed where you can easily determine the primary key of the record the user clicked and then redirect to another page. I'm sure the intended purpose has to do with editing records, but this worked for me. I'm still learning! :-)

Thanks, Z
SOLUTION
Avatar of esteban_felipe
esteban_felipe

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of fahimnxb
fahimnxb

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Ztrain2100
Ztrain2100

ASKER

Sometimes the simplest solution is the best. Thank you for your answers
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo