我在ListView的ItemTemplate中设置了一个LinkButton。它显示正常,但点击时它没有做任何事情。它应该是一个简单的编辑按钮,但它让我疯狂。这是按钮:
<asp:LinkButton ID="EditLinkButton" runat="server" CommandName="Edit" Text="Edit" />
这是代码隐藏的代码:
Protected Sub MyListView_ItemEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewEditEventArgs) Handles MyListView.ItemEditing
MyListView.EditIndex = e.NewEditIndex
GetListViewData()
End Sub
什么可能导致链接什么都不做?
如果有帮助,这是整个列表视图:
<asp:ListView ID="MyListView" runat="server" DataKeyNames="my_id">
<LayoutTemplate>
<table cellpadding="3">
<tr class="tableHeader">
<th>
Name
</th>
<th>
</th>
</tr>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr class="tableRow">
<td>
<%#Eval("my_name")%>
</td>
<td>
<asp:LinkButton ID="EditLinkButton" runat="server" CommandName="Edit" Text="Edit" />
|
<asp:LinkButton ID="DeleteLinkButton" runat="server" CommandName="Delete" Text="Delete" />
</td>
</tr>
</ItemTemplate>
<EditItemTemplate>
<tr class="tableRow">
<td>
<asp:TextBox ID="NameTextBox" runat="server" Columns="30" />
</td>
<td>
<asp:LinkButton ID="CancelLinkButton" runat="server" CommandName="Cancel" Text="Cancel" />
|
<asp:LinkButton ID="DeleteLinkButton2" runat="server" CommandName="Delete" Text="Delete" />
</td>
</tr>
</EditItemTemplate>
</asp:ListView>
答案 0 :(得分:0)
我的不好 - 我在表单的其他地方有验证器,所以链接似乎什么也没做,因为它绊倒了验证。