0
我有一個LinkButton在ListView的ItemTemplate中設置。它顯示正常,但點擊時沒有做任何事情。它應該是一個簡單的編輯按鈕,但它讓我瘋狂。這裏的按鈕:ListView編輯命令按鈕不會迴應
<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>
只是爲了確認,它是您嘗試使用的EditLinkButton?如果你在你的函數中放置了一個斷點,我認爲它沒有被擊中。 – RSolberg 2009-03-05 21:16:02