I have Datalist that is inside an updatepanel and it is in panel in modalpopupextender;
I can list items as I wanted. I am also putting 2 buttons nfor Delete and AddBelow. Here is the markup:
<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>
And register evenst like following: (I have used both ItemCommand and DeleteCommand to see which works:)
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;
}
}
But when I click Delete Or AddBelow buttons I get following error:
Invalid postback or callback argument. Event validation is enabled using 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.
I have disabled eventvalidation of page but the event couldn't be catched...
What am I missing here?