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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dorababu MekaRank #457 · 5.5K reputationPosted Jan 9, 2013, 2:30 AM EST
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;
}
Dorababu MekaRank #457 · 5.5K reputationPosted Jan 9, 2013, 1:16 AM EST
Retrieve session
if(Session["SomeText"]!=null)
{
string strSessionValue=Session["SomeText"].ToString();
}
jesper89 reputationPosted Jan 9, 2013, 1:26 AM EST
Dorababu MekaRank #457 · 5.5K reputationPosted Jan 9, 2013, 1:33 AM EST
{
Session["SomeText"]=yourtextbox.Text;
}
jesper89 reputationPosted Jan 9, 2013, 1:41 AM EST
Dorababu MekaRank #457 · 5.5K reputationPosted Jan 9, 2013, 1:52 AM EST
jesper89 reputationPosted Jan 9, 2013, 2:02 AM EST
what am i writing in the html?
Dorababu MekaRank #457 · 5.5K reputationPosted Jan 9, 2013, 2:06 AM EST
Dorababu MekaRank #457 · 5.5K reputationPosted Jan 9, 2013, 2:17 AM EST
http://www.c-sharpcorner.com/UploadFile/99bb20/storing-and-retrieve-value-using-session-storage-in-html5/
jesper89 reputationPosted Jan 9, 2013, 2:27 AM EST
jesper89 reputationPosted Jan 9, 2013, 2:58 AM EST
bhavnish kapoor2 reputationPosted Sep 1, 2014, 8:17 AM EDT