473,399 Members | 3,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,399 software developers and data experts.

Gridview HyperlinkField question

Hello:
I have a hyperlink field in my gridview that redirects to a new page. I
would like to set a session variable to a value from the grid row where the
hyperlink was clicked before the redirection occurs. Is this possible? Can
anyone offer any suggestions?

Peter

<asp:GridView ID="Townlist" runat="server" >

<Columns>

<asp:HyperLinkField DataTextField="TownName"
HeaderText="Town" NavigateUrl="search.aspx" />
<asp:BoundField DataField="Townname" HeaderText="Town"
SortExpression="Town" />
<asp:BoundField DataField="Expires" HeaderText="Expires"
SortExpression="Expires" />
<asp:ButtonField ButtonType="Button" CommandName="Zip"
Text="Download" />

</Columns>
</asp:GridView>

Nov 20 '07 #1
1 2485
Peter wrote:
Hello:
I have a hyperlink field in my gridview that redirects to a new page. I
would like to set a session variable to a value from the grid row where the
hyperlink was clicked before the redirection occurs. Is this possible? Can
anyone offer any suggestions?

Peter

<asp:GridView ID="Townlist" runat="server" >

<Columns>

<asp:HyperLinkField DataTextField="TownName"
HeaderText="Town" NavigateUrl="search.aspx" />
<asp:BoundField DataField="Townname" HeaderText="Town"
SortExpression="Town" />
<asp:BoundField DataField="Expires" HeaderText="Expires"
SortExpression="Expires" />
<asp:ButtonField ButtonType="Button" CommandName="Zip"
Text="Download" />

</Columns>
</asp:GridView>
We can't access session variable in client. So i think you might replace
HyperLink control to LinkButton control and capture Click event in
button, and then access session on event handler on web server and
redirect to new page.

--
Duy Lam Phuong
Nov 20 '07 #2

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

Similar topics

1
by: MC | last post by:
Hi all, Quick question for you. I need to include a parameter into this asp:HyperLinkField of SchoolID. I tried adding Request.QueryString("SchoolID") but it didnt work. <asp:HyperLinkField...
3
by: Dave Bareham | last post by:
I'm fairly new to this so bear with me! I have created a gridview in an aspx page which successfully talks to a SQL backend via a datasource. One of the colums contains a reference to an image...
1
by: willip | last post by:
I have a Gridview control with a Databound Hyperlink. e.g.: <asp:HyperLinkField HeaderText="MyTitle" DataNavigateUrlFields="MyID" DataNavigateUrlFormatString="~/ShowMe.aspx?MyID={0}"...
1
by: le0 | last post by:
Guys, Im a newbies in asp.net and i have this big prob. How can i get the ID or the primary key of a table? Im using GridView to display all the data. I want to pass that value to another page...
2
by: SP | last post by:
Hi, I need a GridView that when I click on a row or on a HyperLinkField a javascript call raise . It is possible? The grid is in a window open from a parent window. Onclick in a row selected,...
0
by: rmgalante | last post by:
Hi, I've been experimenting with the ASP.Net GridView and encountered some interesting issues that I thought I would share. I have a page that loads a GridView with a generic collection of...
8
by: =?Utf-8?B?TWlrZSBSYW5k?= | last post by:
I am trying to get a list of files from a specified directory using the System.IO namespace classes, and then use that list as the datasource for a GridView. I have been able to do this...
0
by: bodamithun | last post by:
Hi all, For some weird reason my hyperlinkfield does not work. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" > ...
1
by: boevermann | last post by:
I prototyped an html table that has a hyperlink that pops a window showing a map of the entry from the that table. The link looks like this: <a href="authenticate.asp"...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.