472,328 Members | 1,141 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 11755
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...
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...
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...
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...
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...
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...
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...
4
by: jack | last post by:
Hi, Consider the following handler: protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; if...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.