Solved

How to reset hyperlinks in ASP.Net DataGrid

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 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

21 Experts available now in Live!

Get 1:1 Help Now