Hi,
please refer to the application in the attachment .
i set grid's LoadOnDemand property to "Xml", then set a value to session variable in UpdateRow event.
then, i want to get the value of session variable in Button2_Click event.
please according to the follow steps.
1. click add new row button
2. input text for new row
3. click save button
why can't i get the value of session variable in Button2_Click event?
4. don't do anything ,only click save button again
then i can get the value of session variable in Button2_Click event.
i am not understand what reason cause this problem happen?
please give me some suggestion.
thank you very much!
Hi, maybe I can help you, but I'm not a C# programmer. I think the problem is in the way that you are trying yo get the session value
For example, you cant declare your data type twice, because it's already declared, as you did in this line:
this.TextBox1.Text =Session["Test"] as string;
Replace that with this:
this.TextBox1.Text =Session["Test"];
Then you should see in the text box the value stored in the Session Variable.
Thank for your Reply. i'm try,but the issue still occur,first time , first time,the session value still null
Ah, but that's because you haven't set that variable, try setting some value in the load event of the page, that will work!
thank for your reply.i am sorry , i am not understand your meaning.
if i have set Session["Test"]="Test" in the page load event, then set Session["Test"]="This is a test"
in the UpdateRow event
but ,First click "save" button, i still get a value of "Test", rather than "This is a test"