.aspx
ボタンをクリックすると開くボタンを含むページがありますpopup
。ポップアップウィンドウはAJAXFileUpload
コントロールを持っています。ボタンをクリックしてポップアップを開くと、session
値がポップアップに送信され、page load
これらの値がおよびにsession
割り当てられます。ViewState
HiddenField
DataTable
問題:それを含む
ポップアップのボタンをclick
オンにすると、画像が のテーブルに保存されます。このイベントでは、値にアクセスできません。理由がわかりません。Upload
AjaxFileUpload
AJAXUploadComplete
event
ViewState,HiddenField and DataTable
ポップアップ.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.
Session
ただし、ポップアップで使用すると、ウィンドウの複数のインスタンスが一度に開かれる可能性があるため、ポップアップが開いた後にデータを格納するために使用できるカントのすべての値がフラッシュされます。
また、query string
Popup で値を送信するために使用すると、contextkey と guidAjaxFileUpload
が追加されるため、エラーが発生します。its own querystring
解決策/変更を提案してください。