Sorry I'm not bright. Yes I can add the arraylist to viewstate, I don't see
the difference to what I'm doing now, fetching it from Application. However
I don't get notification that the page is about to be dismissed, so how to
save the current value of the combo?
I would think that if the user clicks on a control, a button in this case,
before anything happens I'd get notified. Even at the script level.
"Sudhakar Sadasivuni[mvp]" wrote:
You can add the arraylist to viewstate on pageload. and for all consequent
loads you can check for the same in ViewState and load. making objects static
also works fine but not recommended.
Sudhakar Sadasivuni
http://one.mvpblog.com
http://www.mugh.net
"Coffee guy" wrote:
I have a combo that gets bound to an ArrayList in Page_Load. Problem is when
user clicks on a button the page is re-loaded, however the combo's DataSource
is null. How can I get the combo to keep it's reference to the DataSource
during the re-load? I would like for the current selected item in the combo
to survive the page re-load.
private void Page_Load(object sender, System.EventArgs e)
{
if( !IsPostBack )
{
ArrayList aZips = (ArrayList) (Application["Zips"]);
cboZip.DataSource = aZips;
cboZip.DataBind();
}
}