We help IT Professionals succeed at work.

response. redirect

shragi
shragi used Ask the Experts™
on
buffer.Write("<INPUT type=\"submit\" name=\"Save\" value=\"Save\" onclick=\"edit_text();\">" + " ");

buffer.Write("<script type=\"text/javascript\">");
                    buffer.Write("function edit_text(){");
 buffer.Write("var txtVal = ''hello");
          buffer.Write("Response.Redirect(\"abc.aspx?id=" + txtVal );  \")");
               buffer.Write("}");
                         buffer.Write("</script>");



is the above syntax correct...

i am writing the above code in aspx.cs page.... when i click the save button the function should redirect to other page with a variable
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Response.Redirect is an ASP(X) function, not a javascript function. You could use
buffer.Write("window.location = 'abc.aspx?id=' + txtVal");
or
buffer.Write("document.location = 'abc.aspx?id=' + txtVal");

Author

Commented:
buffer.Write("<input type=\"text\" name=\"name\" id=\"foredit\" />" + " ");

text entered in textbox should be sent to other form as soon as button is clicked....

buffer.Write("<INPUT type=\"submit\" name=\"Save\" value=\"Save\" onclick=\"document.location'abc.aspx?id=' + foredit.text");\">" + " ");

Author

Commented:
the above two are not working... what should be modified...

Commented:
Change
 buffer.Write("var txtVal = ''hello");

to

 buffer.Write("var txtVal = 'hello'");