User-218090889 posted
I have a Datalist container that contains Label and click button on a aspx page that usually pop up from my pain page. when I tried to run the page and click the button I get an error message the says:
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.
below is my aspx for DataList
<asp:DataList ID="DataList1" runat="server" Height="46px" OnSelectedIndexChanged="DataList1_SelectedIndexChanged" RepeatColumns="5" RepeatDirection="Horizontal" Width="385px" CellPadding="4" ForeColor="#333333">
<AlternatingItemStyle BackColor="White" />
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"Name") %>' style="font-size: small"></asp:Label>
<br />
>
<br />
<asp:Button ID="Button1" runat="server" Text="Enter Lot" Width="102px" CausesValidation="False" CommandName="Accept" OnClick="Button4_Click" />
</ItemTemplate>
</asp:DataList>
This is my Code.
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (!object.Equals(Session["UserId"], null))
{
if (e.CommandName == "Accept")
{
My codes
}
}
}
Please any Idea on how I can resolve the error?