T
TumurS
My DataGrid control has footer and this footer contains a custom web user
control. The control included via footer template at the desing time. I
don't create it manually.
The user control contains a DropDownList that populates data on its own Load
event as :
if (!IsPostBack)
{
...
rdr = cmd.ExecuteReader();
MyLst.DataValueField = "...";
MyLst.DataKeyField = "...";
MyLst.DataSource = rdr;
MyLst.DataBind();
rdr.Close();
conn.Close();
}
As you see, it populates items only one time.
ViewState at all levels (page, control, item and etc) is enabled.
After postbacks the the list does not lose its items if the datagrid does
not
do re-binding. But if my some commands force re-binding of the datagrid.
And after re-binding, the list becomes empty. What am I doing wrong?
Any help?
control. The control included via footer template at the desing time. I
don't create it manually.
The user control contains a DropDownList that populates data on its own Load
event as :
if (!IsPostBack)
{
...
rdr = cmd.ExecuteReader();
MyLst.DataValueField = "...";
MyLst.DataKeyField = "...";
MyLst.DataSource = rdr;
MyLst.DataBind();
rdr.Close();
conn.Close();
}
As you see, it populates items only one time.
ViewState at all levels (page, control, item and etc) is enabled.
After postbacks the the list does not lose its items if the datagrid does
not
do re-binding. But if my some commands force re-binding of the datagrid.
And after re-binding, the list becomes empty. What am I doing wrong?
Any help?