Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The state information is invalid for this page and might be corrupted. Error occurs when click gridview events.this error occurs only when page load call display function.

C#
protected void Page_Load(object sender, EventArgs e)
    {
        string userID = Session["Member"].ToString();

       

       Display();
    }

protected void Display()
    {
        DataSet ds = new DataSet();
        string _UserName = Session["Member"].ToString();
        MemberUpload objDisplay = new MemberUpload();
        ds = objDisplay.GetUploadDetailsByUserName(_UserName, "D", "%");
        if (ds.Tables.Count > 0)
        {
            GvNews.DataSource = ds;
            GvNews.DataBind();
        }
        else
        {
            GvNews.DataSource = null;
            GvNews.DataBind();
        }
}
Posted
Updated 10-Sep-12 21:33pm
v2

Do some initial research. This should help - The state information is invalid for this page and might be corrupted[^]

If it doesn't help, come back again with your findings.
 
Share this answer
 
Use Page.IsPostback property. On event clicks, when page gets postback, your Display() method re-executes and attaches data with Grid.

Try:
C#
protected void Page_Load(object sender, EventArgs e)
{
   if(!IsPostback)
   {
     string userID = Session["Member"].ToString();
     Display();
   }
}
 
Share this answer
 
Comments
Shibiny 11-Sep-12 4:37am    
yes.there is no error now.but i want it in ispostback

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900