Asp.net 为什么使用AJAXFileUpload进行部分回发时会丢失ViewState和控件值?

Asp.net 为什么使用AJAXFileUpload进行部分回发时会丢失ViewState和控件值?,asp.net,ajax,file-upload,popup,state-management,Asp.net,Ajax,File Upload,Popup,State Management,我有一个.aspx页面,其中包含一个按钮,单击按钮可打开弹出窗口。 弹出窗口具有AJAXFileUpload控件。单击按钮打开弹出窗口时,会话值被发送到弹出窗口,在页面加载上,这些会话值被分配给视图状态和隐藏字段,数据表 问题: 当我在包含AjaxFileUpload的弹出窗口中单击上传按钮时,它将图像保存到AJAXUploadComplete事件中的表中在这种情况下,我无法访问视图状态、HiddenField和DataTable值不知道为什么 Popup.aspx.cs DataTab

我有一个
.aspx
页面,其中包含一个按钮,单击按钮可打开
弹出窗口。
弹出窗口具有
AJAXFileUpload
控件。单击按钮打开弹出窗口时,
会话
值被发送到弹出窗口,在
页面加载
上,这些
会话
值被分配给
视图状态
隐藏字段
数据表

问题: 当我
在包含
AjaxFileUpload
的弹出窗口中单击
上传
按钮时,它将图像保存到
AJAXUploadComplete
事件中的表中在这种情况下,我无法访问
视图状态、HiddenField和DataTable
值不知道为什么

Popup.aspx.cs

    DataTable dt=new DataTable();
     protected void Page_Load(object sender, EventArgs e)
        {

                int noOfImages;
                string[] imagePaths;
                if (dt != null && dt.Rows.Count==0)
                {
                    dt.Columns.Add("QuoteID");
                    dt.Columns.Add("PrepID");
                    dt.Columns.Add("IsPrep");
                    dt.Rows.Add(string.Empty, string.Empty, string.Empty);
                }
                if ((!IsPostBack ))
                {
                    if (Session["IsPrep"] != null || ViewState["IsPrep"]!= null)
                    {
                       int Isprep = Convert.ToInt32(Session["IsPrep"].ToString());

                       if (Session["IsPrep"] != null)
                       {
                           ViewState["IsPrep"] = Session["IsPrep"];
                           ViewState["QuoteID"] = Convert.ToString(Session["QuoteIDForListing"]);
 int intQuoteID = Convert.ToInt32(ViewState["QuoteID"]);
                        hdnQuoteID.Value = intQuoteID.ToString();
                           ViewState["PrepID"] = Convert.ToString(Session["PrepIDForListing"]);

                           if (dt != null && dt.Rows.Count > 0)
                           {
                               dt.Rows[0]["QuoteID"] = Convert.ToString(Session["QuoteIDForListing"]);
                               dt.Rows[0]["PrepID"] = Convert.ToString(Session["PrepIDForListing"]);
                               dt.Rows[0]["IsPrep"] = Convert.ToString(Session["IsPrep"]);
                           }

                           Session["IsPrep"] = null;
                           Session["QuoteIDForListing"] = null;
                           Session["PrepIDForListing"] = null;

                       }
                    }
                 }
       }

 protected void AjaxFileUpload1_UploadComplete1(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
    {
         //here: ViewState,HiddenField,DataTable values are all get cleared dont know why?
            if (dt != null && dt.Rows.Count > 0)
            { 
                //here dt is set to null any idea?
            }
           //if (!string.IsNullOrEmpty(Convert.ToString(ViewState["QuoteID"])))
                if (!string.IsNullOrEmpty(Convert.ToString(hdnQuoteID.Value))&& hdnIsPrepId.Value=="0")
                {
                    int QuoteID = Convert.ToInt32(ViewState["QuoteID"]);
                    ///some code here
                }
               // else if (!string.IsNullOrEmpty(Convert.ToString(ViewState["PrepID"])))
                else if (!string.IsNullOrEmpty(Convert.ToString(hdnPrepID.Value)) && hdnIsPrepId.Value == "1")
                {
                    int PrepID = Convert.ToInt32(ViewState["PrepID"]);
                   ///some code here
                }
    }
注意:相同的功能可以在页面上正常工作。但是,与弹出窗口一起使用时,它刷新了
HiddenField、DataTable、ViewState的所有值。
会话
打开弹出窗口后不能用于存储数据,因为一次可能打开多个窗口实例

此外,当将
查询字符串
与弹出窗口一起使用以发送值时,
AjaxFileUpload
在附加
自己的查询字符串
contextkey和guid时出错

请提出任何解决方案/更改