Form Auotposts

G

Guest

Hi,
I have an ASP.net form. I have some drop downs and load the values on the
form_load. I disabled the viewstate, because I didn't want to post the form
and it was huge because of the values in the dropdowns.

All I am doing is taking the values of drop downs and passing through a
querystring to a new window through window.open. But when the new window
opens the form is also posted to the server and since I have disabled the
view state, all the dropdowns are now empty. How can I disable the form from
being auto posting to the server.

Thanks for your hlep in advance.
 
S

Stefan

Basically you need to invoke a javascript method to open the new window
and then return _false_.

If you do this from an asp.net control like a button you need to bind
an onclick handler to this button:
- ButtonSave.Attributes.Add("onclick", "openWindow();"
- openWindow should return false, otherwise the form gets posted.

It's more tricky if you have clientside validation before opening the
window (using ValidatorOnSubmit())
but from what I read you don't need that.

PS: Just to understand - are you saying your viewstate gets bigger with
the number of items in your dropdowns?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top