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
Solved

How to reset hyperlinks in ASP.Net DataGrid

Posted on 2004-03-21
5
650 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 250 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 250 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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