473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

LinkButton Visited Link on ASP.NET Gridview Issue

Hi, I have a ASP.NET 2.0 Web Application. Many of the pages use the ASP.NET
GridView with paging and sorting.
One of the columns of this Gridview is a template column (LinkButton). The
data being retrieved and showed in this GridView produce more than one page
of data.
A given user clicks on the first row hyper link on the Grid on the first
page, then the first row hyper link color changes to look as "visited".
Then the user navigates to a different page number on the GridView by
clicking on the page number (say 2).
Then on the 2nd page, the color of first row hyperlink on the Grid is
automatically changed to look as visited even though he is navigating to the
page number 2 for the first time.
Users would expect the hyper links on the 2nd (or any other ) page should
look like not visited, when they are navigating for the first time and not
yet clicked on the hyper link.

Any ideas on how to solve this?
Thanks for your help.
Sep 6 '07 #1
4 11876
Jeff,

In your template link add a unique id as part of the hyperlink target - this
will ensure that the browser recognises them as different links.
By default GridView injects a row number into the hyperlink, so that ASP.Net
can tell which link button is generated the click. As your row numbers are
the same on page 1 as on the subsequent pages - you can see that the browser
marks them as been clicked on.

Hope it makes sense

"Jeff" wrote:
Hi, I have a ASP.NET 2.0 Web Application. Many of the pages use the ASP.NET
GridView with paging and sorting.
One of the columns of this Gridview is a template column (LinkButton). The
data being retrieved and showed in this GridView produce more than one page
of data.
A given user clicks on the first row hyper link on the Grid on the first
page, then the first row hyper link color changes to look as "visited".
Then the user navigates to a different page number on the GridView by
clicking on the page number (say 2).
Then on the 2nd page, the color of first row hyperlink on the Grid is
automatically changed to look as visited even though he is navigating to the
page number 2 for the first time.
Users would expect the hyper links on the 2nd (or any other ) page should
look like not visited, when they are navigating for the first time and not
yet clicked on the hyper link.

Any ideas on how to solve this?
Thanks for your help.
Sep 7 '07 #2
On 7 , 00:08, "Jeff" <jeffrey.sanchez.isth...@gmail.comwrote:
Hi, I have a ASP.NET 2.0 Web Application. Many of the pages use the ASP.NET
GridView with paging and sorting.
One of the columns of this Gridview is a template column (LinkButton). The
data being retrieved and showed in this GridView produce more than one page
of data.
A given user clicks on the first row hyper link on the Grid on the first
page, then the first row hyper link color changes to look as "visited".

Because LinkButton does not redirect to another url the "visited/
unvisited pages" concept has no sense in this case. Maybe is it better
do not change the color of these linkbuttons at all? It can be done
with CSS.

<style type="text/css">
a.btn, a.btn:link, a.btn:active, a.btn:visited, a.btn:hover
{
color: blue;
}
</style>
....
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="btn"></
asp:LinkButton>

Regards,
Mykola
http://marss.co.ua

Sep 7 '07 #3
Thanks Mikola for your answer.
Well, the thing is that in our case the linkbutton does redirects the user
to another page. What we do is a postback to the same page where we then
setup some needed variables and then we redirect the user to another page ,
say page 2 that uses those variables.

Thanks again for your help.
"marss" <ma******@gmail.comwrote in message
news:11*********************@o80g2000hse.googlegro ups.com...
On 7 , 00:08, "Jeff" <jeffrey.sanchez.isth...@gmail.comwrote:
>Hi, I have a ASP.NET 2.0 Web Application. Many of the pages use the
ASP.NET
GridView with paging and sorting.
One of the columns of this Gridview is a template column (LinkButton).
The
data being retrieved and showed in this GridView produce more than one
page
of data.
A given user clicks on the first row hyper link on the Grid on the first
page, then the first row hyper link color changes to look as "visited".


Because LinkButton does not redirect to another url the "visited/
unvisited pages" concept has no sense in this case. Maybe is it better
do not change the color of these linkbuttons at all? It can be done
with CSS.

<style type="text/css">
a.btn, a.btn:link, a.btn:active, a.btn:visited, a.btn:hover
{
color: blue;
}
</style>
...
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="btn"></
asp:LinkButton>

Regards,
Mykola
http://marss.co.ua

Sep 7 '07 #4
Thanks Sergey for your responce.

The problem here is that even though theres a way to make unique the gridview's name or the linkbutton's name, the final name of the linkbutton within each row in the gridview is a composition of the gridview's name plus the linkbutton's name plus (and this is the part that I cannot modify) a internal sequence based on the row's number. In other words:

For each row in the gridview that has a linkbutton, there's gonna be a line like the following:

<a id="GridView1_ctl02_Control1" href="javascript:__doPostBack('GridView1$ctl02$Con trol','')">This is a link</a>

and instead of ctl02 it would be ctl03, ctl04, ctl05 and so on...

The part of the line that is in red is where I don't have control. So It doesn't matter if I customize the gridview's name or the linkbutton's name and append to them an unique value. The ctl02 part is gonna be assigned to the 2nd row always, the ctl03 is gonna be assigned to the 3rd row always and so forth, so, there's where I loose control over it.

If we just could take control over this part that the asp.net gridview generates...the ctl02, ctl03, ctl04....it would be a diferent history... :(

Hope I made myself clear...

Thanks guys...

"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.comwrot e in message news:07**********************************@microsof t.com...
Jeff,

In your template link add a unique id as part of the hyperlink target - this
will ensure that the browser recognises them as different links.
By default GridView injects a row number into the hyperlink, so that ASP.Net
can tell which link button is generated the click. As your row numbers are
the same on page 1 as on the subsequent pages - you can see that the browser
marks them as been clicked on.

Hope it makes sense

"Jeff" wrote:
>Hi, I have a ASP.NET 2.0 Web Application. Many of the pages use the ASP.NET
GridView with paging and sorting.
One of the columns of this Gridview is a template column (LinkButton). The
data being retrieved and showed in this GridView produce more than one page
of data.
A given user clicks on the first row hyper link on the Grid on the first
page, then the first row hyper link color changes to look as "visited".
Then the user navigates to a different page number on the GridView by
clicking on the page number (say 2).
Then on the 2nd page, the color of first row hyperlink on the Grid is
automatically changed to look as visited even though he is navigating to the
page number 2 for the first time.
Users would expect the hyper links on the 2nd (or any other ) page should
look like not visited, when they are navigating for the first time and not
yet clicked on the hyper link.

Any ideas on how to solve this?
Thanks for your help.
Sep 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited...
5
by: Dan Jacobson | last post by:
What's Nielsen talking about in http://www.useit.com/alertbox/20040503.html http://www.useit.com/alertbox/20040510.html Can't a good browser keep track of visited vs. unvisited link colors? Is my...
1
by: Gopal Krish | last post by:
I'm have coded a simple menu (using link buttons as menu items) in a user control to be reused across many ASPX pages. In the page_load method I dynamically create the link buttons as follows ...
5
by: graphicsxp | last post by:
Hi, I've added a linkbutton field to my gridview. Now I would like that when the user clicks on it for a particular row, a server-side function should be executed, which takes as parameters the id...
28
by: RAB | last post by:
When my user closes the browser, I want the visited link to change to a "fresh" never been visited link once the user (on the same machine) reopens their browser. Here is the code I am using: ...
2
by: CJM | last post by:
I have a page that allows the user to search a DB by querying one of 3 fields. When results are returned, I want the user to be able to click a value in one of three columns (that directly relate...
1
beacon
by: beacon | last post by:
I'm looking to reset the visited link color once another link is selected. Also, once that link takes me to a particular page, I want the font-weight for that page to be bold to indicate that it's...
4
by: jack | last post by:
Hi, Consider the following handler: protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; if (row.RowType != DataControlRowType.DataRow)...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.