Asp.Net Form Textbox

297 Views Asked by At

Hello I have to make a form in Asp.net, Framework 4.0 with VS 2010. The Form will have 3 Sites, Start, Input and Control. Now i have a little Problem. When I make a Input at the Textboxes on the Input Site and go to the Control Site and back, then I can Change the Text of the Textboxes, but the Text wont be changed in the session.item. I have done it so. Textbox.text -> session.item session.item -> label.text (works)

But when i go back the Text of the session.item doesent change.

Please give me a hint why it does not work.

1

There are 1 best solutions below

2
On

If I'm understanding your question correctly, you're trying to change a session variable after it's set when you change text in a textbox? If that's correct, you should just be able to use the TextChanged event in the textbox to reset the session variable when the TextBox is edited.

Try something like this, linked up to the TextChanged event in the textbox

protected void TextBoxChanged(object sender, EventArgs e)
{
    HttpContext.Current.Session["Text"] = textbox.Text;
}