该页面的状态信息无效,并且可能已损坏.错误 [英] The state information is invalid for this page and might be corrupted. error

查看:73
本文介绍了该页面的状态信息无效,并且可能已损坏.错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该页面的状态信息无效,并且可能已损坏.单击gridview事件时发生错误.仅当页面加载调用显示功能时才会发生此错误.

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.

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();
        }
}

推荐答案

做一些初步研究.这应该有帮助-
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.


使用Page.IsPostback属性.事件单击时,当页面回发时,您的Display()方法将重新执行并使用Grid附加数据.

试试:
Use Page.IsPostback property. On event clicks, when page gets postback, your Display() method re-executes and attaches data with Grid.

Try:
protected void Page_Load(object sender, EventArgs e)
{
   if(!IsPostback)
   {
     string userID = Session["Member"].ToString();
     Display();
   }
}


这篇关于该页面的状态信息无效,并且可能已损坏.错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆