asp.net building controls:
I will treat your "Webform" stuff in any case.
I will treat it like the Viruses" that surround your post.
----------------
And I take pride in saying:
I am not an Idiot.
=============================
Good luck
[quoted text, click to view] "kaasztelann" <kaasztelann@wp.pl> wrote in message
news:bl38mm$q6s$1@atlantis.news.tpi.pl...
> I have a DropDownList on my Webform. This list is bounded to DataSet which
> is populate from database.
> When load the form, list is filled and all is OK. The problem is, that the
> list is small (only 3 items), so I want to preserve the list by ViewState
> (it is on), and want the list to be populated from database only first
time
> (when IsPostBack==false).
> How to bind this control only once? I have 1 solution which I don't like:
>
> If I don't use Page.DataBind(), but <each control>.DataBind(),
> then can then do if(!IsPostBack)MyList1.DataBind();
> It works, but I don't like it, because I have a lot of controls on
form.
>
>
> Is there any other solution?
>
> Please, help
> Gorbi
>
>
I have a DropDownList on my Webform. This list is bounded to DataSet which
is populate from database.
When load the form, list is filled and all is OK. The problem is, that the
list is small (only 3 items), so I want to preserve the list by ViewState
(it is on), and want the list to be populated from database only first time
(when IsPostBack==false).
How to bind this control only once? I have 1 solution which I don't like:
If I don't use Page.DataBind(), but <each control>.DataBind(),
then can then do if(!IsPostBack)MyList1.DataBind();
It works, but I don't like it, because I have a lot of controls on form.
Is there any other solution?
Please, help
Gorbi
[quoted text, click to view] "kaasztelann" <kaasztelann@wp.pl> wrote in message
news:bl38mm$q6s$1@atlantis.news.tpi.pl...
> I have a DropDownList on my Webform. This list is bounded to DataSet which
> is populate from database.
> When load the form, list is filled and all is OK. The problem is, that the
> list is small (only 3 items), so I want to preserve the list by ViewState
> (it is on), and want the list to be populated from database only first
time
> (when IsPostBack==false).
> How to bind this control only once? I have 1 solution which I don't like:
>
> If I don't use Page.DataBind(), but <each control>.DataBind(),
> then can then do if(!IsPostBack)MyList1.DataBind();
> It works, but I don't like it, because I have a lot of controls on
form.
if (!Page.IsPostBack)
{
// Load data from database and then call
DataBind();
}
--
John Saunders
Internet Engineer
john.saunders@surfcontrol.com