Gridview HyperlinkField question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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>
 
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.
 
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
 
Back
Top