How to reset hyperlinks in ASP.Net DataGrid
Posted on 2004-03-21
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.