Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to reset hyperlinks in ASP.Net DataGrid

Posted on 2004-03-21
5
Medium Priority
?
667 Views
Last Modified: 2012-05-04
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

0
Comment
Question by:Ztrain2100
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:esteban_felipe
ID: 10646351
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
0
 

Author Comment

by:Ztrain2100
ID: 10646381
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
0
 
LVL 12

Assisted Solution

by:esteban_felipe
esteban_felipe earned 1000 total points
ID: 10646424
IC....

that's a browser-style specific issue. As all your links are the same, as soon you visit the page, all links will be "visited". You can't control that from server side code.

A easy suggestions for you: In you styles, make the same style from A element  and another for  A:VISITED. Make both styles the same, so there will be no visible difference
0
 
LVL 5

Accepted Solution

by:
fahimnxb earned 1000 total points
ID: 10646703
USE <EditItemStyle cssclass="editRow" />
visit following link for details.
http://p2p.wrox.com/archive/aspx_professional/2003-02/62.asp

OR

<asp:EditCommandColumn ButtonType="PushButton" CancelText="Abbrechen" EditText="Bearbeiten" UpdateText="Speichern" HeaderText="Bearbeiten">
<HeaderStyle CssClass="DGHeaderStyle"></HeaderStyle>
<ItemStyle CssClass="DGButtonCellStyle"></ItemStyle>
</asp:EditCommandColumn>
visit following link for details.
http://www.glengamoi.com/pipermail/asp.net/2003-February/000358.html


OR TRY THIS IN THE STYLE TAG/STYLE SHEET
A:link
{
    COLOR: blue;
}
A:active
{
    COLOR: blue;
}
A:visited
{
    COLOR: blue;
}
A:hover
{
      COLOR: blue;
}

Ask if there is any confusion.
0
 

Author Comment

by:Ztrain2100
ID: 10655305
Sometimes the simplest solution is the best. Thank you for your answers
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question