put hyperlink into asession when clicked

Posted by Ragha under ASP.NET on 5/18/2008 | Views : 2309 | Status : [Member] | Replies : 4
when i click on a hyperlink i would like to put into a session variable and i would like to use it in another page to check the condition

how to do this

please tell me

any help would be appreciated

thanks




Responses

Posted by: SheoNarayan on: 5/18/2008 [Administrator] HonoraryPlatinum

Up
0
Down
You can use asp:LinkButton button control and onClick event you can specify a server side event and creat your session there.


<asp:LinkButton ID="d" runat="Server" Text="Create Session" OnClick="d_Click"></asp:LinkButton>

protected void d_Click(object sender, EventArgs e)
{
Session["youSession"] = "RAM"
}



Regards,
Sheo Narayan
http://www.dotnetfunda.com

Ragha, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ragha on: 5/18/2008 [Member] Starter

Up
0
Down
<table border="0" cellpadding="0"cellspacing="0">
<tr>
<td width="45"></td>
<td><a href="#">Percent Proficient</a ></td>
</tr>
</table>

this is my link
when i click the above link i would like to track

thanks

Ragha, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: SheoNarayan on: 5/18/2008 [Administrator] HonoraryPlatinum

Up
0
Down
Its better to follow my suggested approach or you will have to hanlde it through javascript (there are many approach through javascript and its tough to explain it here but in short create a javascript function onclick even, specify a hidden value to the variable and redirect to the page with querystring and on server side, catch the querystring and specify the value into the session).

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Ragha, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 4/18/2009 [Member] Bronze

Up
0
Down
You can use onserverclick event for this purpose.
http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlbutton.onserverclick(VS.80).aspx

Ragha, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response