469,578 Members | 1,263 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

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 2356
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by MC | last post: by
3 posts views Thread by Dave Bareham | last post: by
1 post views Thread by le0 | last post: by
reply views Thread by rmgalante | last post: by
8 posts views Thread by =?Utf-8?B?TWlrZSBSYW5k?= | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.