Accessing controls in the edititemtemplate of a listview

前端 未结 6 1910
半阙折子戏
半阙折子戏 2021-01-06 10:38

I am working with the listview control. By default I am showing the itemtemplate with an edit button. When the edit button is pressed the listview switches to the edititemte

6条回答
  •  迷失自我
    2021-01-06 11:25

    I don't know about previous editions but in Visual Studio 2010 you can easily access the edit item trhough the "ListView.EditItem" property like this:

    private void myListView_ItemEditing(object sender, ListViewEditEventArgs e)
    {
       myListView.EditIndex = e.NewEditIndex;
       myListView.DataBind();
    
       ListViewItem lvwItem = lvwLista.EditItem;
       ListBox tempLB = (ListBox) lvwItem.FindControl("ListBox3");
    }
    

提交回复
热议问题