Is PostBack Or Is Notpostback
I have created a page and on the page load event i have code to store the values in the dropdownloist from the table which is working fine for me.
I set the property called autopostback for dropdown list to true and when i change the value in the dropdown list it fires the page_load event as well.
And even i click on the button it fires that event as well.
How i can solve this problem.
On page_load event do i need to use (Is Postback or Is Notpostback)
And what property value should i set for dropdownlist for autopostback?
Thanks In advance
[600 byte] By [
mejaz] at [2007-11-19 10:41:06]

# 1 Re: Is PostBack Or Is Notpostback
Basically, if you have something that you want to happen only during the initial page load, just do:
void Page_Load(Object sender, EventArgs e)
{
if (!IsPostBack)
{
// Do initialization code
}
}
Every request to a page will cause the Page_Load handler, regardless of postback state.
Regarding AutoPostBack, it's dependant on what you want to happen. Typically I find drop-down Autopostback to be annoying as it does an entire roundtrip to the server for what is usually a UI update. A slicker way is likely to just do it all Client side and then use a submit button to finally do the roundtrip.
# 2 Re: Is PostBack Or Is Notpostback
Thanks mmetzger for your reply.
Can i store the values in the recordset and can use that recordset later on client side instead of quering everytime on the server.
For Example;
i have loaded the products in the dropdown list and what i want is that if user change the product from the list then it display the other information related to that product.
And i want to make it like disconnected recordset as we can use in vb 6.0.
Any idea or code will greatly appriciated.
Thanks
mejaz at 2007-11-9 11:48:26 >

# 3 Re: Is PostBack Or Is Notpostback
It gets a little hairy depending on what you want to do. If you want to do a lot Client side in a disconnected way, you may need to just serialize a dataset to XML and pass it to the client to parse appropriately. I would not recommend this option if you are actually modifying the data as it may get ugly quick w/ multiple clients.