views:

55

answers:

0

Hello I have a problem with dropdowllist ddl1 that is inside of insertitem of listview. I populate it from table on page load. In Page_load I have:

    if (!Page.IsPostBack)
    {
        ListView1.DataBind();
        InsDropDownList3.DataSource = GetAllPlayersName();
        InsDropDownList3.DataBind();
    }
     DropDownList ddl1 = (DropDownList)ListView1.InsertItem.FindControl("InsDropDownList1");

     if (ddl1 != null)
     {
         DataTable t = GetAllPlayersName();
         ddl1.DataSource = t;
         ddl1.DataBind();
     }

When I select a row in listview or edit it data from dropdownlist in insertitem row disappears - list became empty until I close page and open again. There is another InsDropDownList3 outside of listview and there is no problem with this one. Why one is loosing data and the other one not? As I understand ddl1 should even get data every time page loads.