OnItemCommand
当我按下里面的按钮时,事件不会触发?我尝试了一些东西,但什么也没发生。我忘了放什么东西吗?我应该怎么做才能修复它?click
ItemTemplate
页面:
<asp:ListView ID="ShowPostsListView" runat="server" OnItemDataBound="ShowPostsListView_ItemDataBound" OnItemCommand="ShowPostsListView_ItemCommand">
<ItemTemplate>
<asp:Button ID="AddCommentButton" CssClass="addCommentButton" runat="server" Text="Add Comment" CommandName="Add Comment" />
</ItemTemplate>
</asp:ListView>
页面后面的代码:
protected void ShowPostsListView_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "Add Comment")
{
...
}
}