Ramachandra
Ramachandra

Reputation: 39

IsPostBack is always True when we Submit the form using Javascript

I am using below code in .js file using asp.net from page1.aspx page

Form1.action = "testpage.aspx"; Form1.submit();

When the form is submitted the IsPostBack is always True when it's redirected to "textpage.aspx"

Is there any things which i am missing here?

Upvotes: 1

Views: 970

Answers (1)

rocky
rocky

Reputation: 7696

You are submitting a form. That's what postback exactly is.

Redirect would be e.g.:

window.location.href = 'testpage.aspx';

EDIT: It's not clear from your post whether the testpage.aspx is the same page as the one containing the submitted form. If you want to avoid postback then you'll have to build a querystring, attach it to the URL and perform a redirect. Then you can access the parameters using Request.Params.

Upvotes: 1

Related Questions