I have a web form and want to 'get' it to another page..
is there anyway to submit it without posting the ViewState
and other bits I don't want?
Or should I be catching the submit button click and redirecting with a querystring I build myself.
I have a web form and want to 'get' it to another page..
is there anyway to submit it without posting the ViewState
and other bits I don't want?
Or should I be catching the submit button click and redirecting with a querystring I build myself.
If you are not using the
viewstate
, why have you kept it enabled? Just disable it. For every server control, set theEnableViewState = False
and you are free from it. If you need theviewstate
, it will be part of the post all the time.There are different ways to persist viewstate.
I have had in the past, had to persist viewstate on the server (using ApplicationState/Session, cant remember) for a heavy AJAX page to support faster updates. Works well.
See
Page.LoadPageStateFromPersistenceMedium
andPage.SavePageStateToPersistenceMedium
.Sorry, no links from Reflector available.
You could add an event handler to your search button and do something similar to this
Using JavaScript
Html
You have a couple of options here:
You don't have to disable ViewState on all pages, just the pages that you do not care for the state to be saved.
But there is also the option to disable the ViewState completely if you never want to use it.
If you just want to compose a GET by yourself, you can use jQuery for that aswell so you only pass the parameters you really want which will give you 100% control of what is posted /getted.