Wednesday 22 October 2014

Przechowywanie datasource pomiędzy PostBack

        private string _countriesList = "countries";
        private List<CountryInfo> _countries;
        private List<CountryInfo> Countries
        {
            get
            {
                if (ViewState[_countriesList] == null)
                    return new List<CountryInfo>();
                return (List<CountryInfo>)ViewState[_countriesList];
            }
            set
            {
                ViewState[_countriesList] = value;
                _countries = value;
            }

        }

No comments:

Post a Comment