Hi
As the headline says.
i cant figure out how i can add value from a textbox on an asp.net side to a session when i press a button. and retrieve the session with the value in a c# method
any help? :)
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dorababu MekaPosted Jan 9, 2013, 7:30 AM
protected void btnSession_Click(object sender, EventArgs e)
{
Session["SomeText"]=txtSession.Text; // Here you can call ur function instead of this
}
If you write a function some thing like
Public void functionName()
{
Session["SomeText"]=txtSession.Text;
}
bhavnish kapoorPosted Sep 1, 2014, 12:17 PM
jesperPosted Jan 9, 2013, 7:58 AM
jesperPosted Jan 9, 2013, 7:27 AM
Dorababu MekaPosted Jan 9, 2013, 7:17 AM
http://www.c-sharpcorner.com/UploadFile/99bb20/storing-and-retrieve-value-using-session-storage-in-html5/
Dorababu MekaPosted Jan 9, 2013, 7:06 AM
jesperPosted Jan 9, 2013, 7:02 AM
what am i writing in the html?
Dorababu MekaPosted Jan 9, 2013, 6:52 AM
jesperPosted Jan 9, 2013, 6:41 AM
Dorababu MekaPosted Jan 9, 2013, 6:33 AM
{
Session["SomeText"]=yourtextbox.Text;
}
jesperPosted Jan 9, 2013, 6:26 AM
Dorababu MekaPosted Jan 9, 2013, 6:16 AM
Retrieve session
if(Session["SomeText"]!=null)
{
string strSessionValue=Session["SomeText"].ToString();
}