Button in the page does not work after the page is executed. the function of this button is to retrieve the images from the paths provided. the use of isPostBack is important here but am not getting where to use it.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class pictures : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Image1.ImageUrl = "~/Images/10003253_697566723628663_1903222345_n.jpg";
Image2.ImageUrl = "~/Images/1503929_10152290013211351_1280973165_n.jpg";
Image3.ImageUrl = "~/Images/1558538_697566540295348_743334414_n.jpg";
}
}
when the page is loaded and i click the button then this error message is provided:
Server Error in '/' Application.
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. "
The aspx code is:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="pictures.aspx.cs" Inherits="pictures" MasterPageFile="~/MasterPage.master"%>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Image ID="Image1" runat="server" Height="200px" />
<asp:Image ID="Image2" runat="server" Height="200px" />
<asp:Image ID="Image3" runat="server" Height="200px" /><br />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" is/>
</asp:Content>