开发者

how to edit own item in listview asp.net

I want to implement a comment list and use list 开发者_开发问答view to binding data. But now I have a problem that, only specific item can be deleted or edited by owner. how to config list view to do this function, thanks!


Once the list is bound (like in OnDataBound event), iterate through the items, and use logic similar to this:

foreach (ListViewDataItem item in ListView1.Items)
{
    btnDelete.Enabled = User.UserID == ListView1.DataKeys[item.DataItemIndex]["UserID"];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜