Accessing controls in the edititemtemplate of a listview

前端 未结 6 1952
半阙折子戏
半阙折子戏 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:28

    I've figured out a way to do what I need to do, though I'm not terribly happy with it.

    protected void UnitsLV_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        if (UnitsLV.EditIndex > -1)
        {
            // Controls within the edititemtemplate are available via e.Item.FindControl("controlname")
        }
    }
    

提交回复
热议问题