ListView里的ItemCommand--笔记
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "EnableUr") { //int index = ((ListViewDataItem)e.Item).DisplayIndex; //Guid id = (Guid)ListView1.DataKeys[index].Value; int index = ((ListViewDataItem)e.Item).DisplayIndex; Guid id = (Guid)ListView1.DataKeys[index].Value; T_UsersTableAdapter adapter = new T_UsersTableAdapter(); adapter.EnableUrById(id); ListView1.DataBind(); } else if (e.CommandName == "DisableUr") { int index = ((ListViewDataItem)e.Item).DisplayIndex; Guid id = (Guid)ListView1.DataKeys[index].Value; T_UsersTableAdapter adapter = new T_UsersTableAdapter(); adapter.DiableUrById(id); ListView1.DataBind(); } }
本博客(liqipeng)除非已明确说明转载,否则皆为liqipeng原创或者整理,转载请保留此链接:https://www.cnblogs.com/liqipeng/archive/2012/07/18/4576201.html。
本博客(liqipeng)除非已明确说明转载,否则皆为liqipeng原创或者整理,转载请保留此链接:https://www.cnblogs.com/liqipeng/archive/2012/07/18/4576201.html。
如果你觉得这篇文章对你有帮助或者使你有所启发,请点击右下角的推荐按钮,谢谢,:)