drugsaddiction
New Member
I have following code .In asp.net , I set session variable .Then pass it to javascript for modification .In javascript I can read session variable value and return modified value in TextBox1 .In asp.net again , I receive modified session variable value and store it in session variable .\[code\]protected void Page_Load(object sender, EventArgs e){ Session["MyTest"] = "abcd"; String csname = "OnSubmitScript"; Type cstype = this.GetType(); // Get a ClientScriptManager reference from the Page class. ClientScriptManager cs = Page.ClientScript; // Check to see if the OnSubmit statement is already registered. if (!cs.IsOnSubmitStatementRegistered(cstype, csname)) { string cstext = " document.getElementById(\"TextBox1\").value = http://stackoverflow.com/questions/15590634/getMyvalSession() ;"; cs.RegisterOnSubmitStatement(cstype, csname, cstext); } if (TextBox1.Text.Equals("")) { } else { Session["MyTest"] = TextBox1.Text; }} <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"><script language=javascript type="text/javascript"> function getMyvalSession() { var txt = "efgh"; var ff = '<%=Session["MyTest"] %>' + txt; return ff ; }</script></head><body><form id="form1" runat="server"><div> <asp:TextBox ID="TextBox1" runat="server" AutoPostBack=true ></asp:TextBox> <input type="submit" value="http://stackoverflow.com/questions/15590634/Submit" /></div></form></body> </html>\[/code\]But my aim was