Solved

How to reset hyperlinks in ASP.Net DataGrid

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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 …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now