我有一个更新面板内的 Datalist,它位于 modalpopupextender 的面板中;
我可以列出我想要的项目。我还为 Delete 和 AddBelow 放置了 2 个按钮。这是标记:
<asp:DataList ID="SpeedDialsDL" runat="server">
<ItemTemplate>
<table id="speedDialValueEditorTable" width="100%">
<tr>
<td width="275px">
<asp:Label ID="ValueLabel" runat="server" Text="Value"></asp:Label>
</td>
<td>
<asp:TextBox ID="ValueTextBox" runat="server" Text='<%# Eval("Value") %>' Width="340px"
Enabled="false"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="Delete" runat="server" Text="Delete" CommandName="Delete"
CausesValidation="false" />
<asp:Button ID="AddNewButton" runat="server" Text="AddBelow" CommandName="AddBelow"
CausesValidation="false" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
并注册如下事件:(我同时使用了 ItemCommand 和 DeleteCommand 来查看哪个有效:)
protected void Page_Load(object sender, EventArgs e)
{
SpeedDialsDL.ItemCommand += SpeedDialsDL_ItemCommand;
SpeedDialsDL.DeleteCommand += SpeedDialsDL_ItemCommand;
}
void SpeedDialsDL_ItemCommand(object source, DataListCommandEventArgs e)
{
switch (e.CommandName)
{
case "Delete":
this.DeleteFromList((string)e.CommandArgument);
break;
case "AddBelow":
break;
}
}
但是当我单击 Delete 或 AddBelow 按钮时,我收到以下错误:
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
我已禁用页面的事件验证,但无法捕获该事件...
我在这里想念什么?