473,700 Members | 2,866 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11895
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.sanche z.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:LinkButt on 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******** *************@o 80g2000hse.goog legroups.com...
On 7 , 00:08, "Jeff" <jeffrey.sanche z.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:LinkButt on 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_c tl02_Control1" href="javascrip t:__doPostBack( 'GridView1$ctl0 2$Control','')" >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************ *****@discussio ns.microsoft.co mwrote in message news:07******** *************** ***********@mic rosoft.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
automaticall y 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
17079
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 link and the text of the link under the cursor are red. All other links should be white. The problem with the construction above is that a visited link remains for the rest of the session red regardless wether it was visited 17 clicks back in...
5
2417
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 site deficient as I have not messed with link colors? Does Nielsen address why all this can't be left up to the browser? Are link colors supposed to be special, like background images, to make a big impression?
1
2584
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 LinkButton myLB = new LinkButton(); ......... .........
5
4932
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 of the selected row. How can I do that ? Thanks
28
2659
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: /* buttons.css */ body { font-family: Verdana, sans-serif; color: black; background-color: white; } h1 { color: navy; }
2
2512
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 to the 3 searchable fields) and have the page postback and requery given the selected criterion. For example, the user searches for retainer #1, which has a Tip Width of 5. So he clicks on the 5 and it searches again for all retainers that have a...
1
4112
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 the page you're looking at. Now, if the links have never been visited before, they are blue. If you hover over the links they turn light blue. I want the user to be able to select the link and it take you to that page. On that page, I want the link...
4
17915
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) return;
0
8721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9209
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8918
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6558
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5900
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4653
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2385
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2024
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.