Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to reset hyperlinks in ASP.Net DataGrid

Posted on 2004-03-21
5
Medium Priority
?
662 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
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…

688 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