Gridview HyperlinkField question

P

Peter

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>
 
D

Duy Lam

Peter said:
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.
 
P

Peter

Thanks Duy Lam:
Does anyone know of a reference document that explains the event model and
the techniques for accessing data elements for the gridview?
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top