Form Auotposts

Discussion in 'ASP .Net' started by =?Utf-8?B?ZG90bmV0dGVzdGVy?=, Aug 28, 2005.

  1. 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.
     
    =?Utf-8?B?ZG90bmV0dGVzdGVy?=, Aug 28, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?ZG90bmV0dGVzdGVy?=

    Stefan Guest

    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?
     
    Stefan, Aug 29, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dbuchanan
    Replies:
    2
    Views:
    2,632
    dbuchanan
    Dec 19, 2005
  2. Mart Rogers

    passing arguments from web-form to win-form

    Mart Rogers, Jul 8, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    604
    Natty Gur
    Jul 9, 2003
  3. Adam Benson

    Form in a form - possible ?

    Adam Benson, Jul 22, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    410
    Adam Benson
    Jul 29, 2003
  4. Li Zhang
    Replies:
    4
    Views:
    6,123
    softip
    Feb 27, 2009
  5. rob c
    Replies:
    4
    Views:
    352
    McKirahan
    Dec 30, 2005
Loading...

Share This Page