我對我有一個非常敏感的未解決的錯誤。 請看看這個forums,Linkbutton點擊打開modalpopup,瀏覽器後退按鈕導致「Document expired」
對ASP:LinkButton的點擊,如果單擊後退按鈕一modalPop將被打開,在此,瀏覽器顯示「文件過期」
LinkButton的是GridView和命令內動態添加此外,點擊動態添加linkbutton「lnkBtnBookTheSelected_Click」功能將被稱爲那裏我捕獲選定的行ID。
bool CheckAvailability()
{
//some logical code and getting data in "statusList"
Session["Availability"] = statusList;
gridViewAvailability_DataBound(null,null);
}
protected void gridViewAvailability_DataBound(object sender, EventArgs e)
{
string[] statusList = (string[])Session["Availability"];
try
{
if (statusList.Length > 0)
{
int i = 1;
foreach (GridViewRow row in gridViewAvailability.Rows)
{
row.Cells[3].Controls.Clear();
if (statusList[i - 1] == "Available")
{
LinkButton lb = new LinkButton();
lb.Text = "Book this?";
lb.CommandArgument =i.ToString();
lb.Command+=lnkBtnBookTheSelected_Click;
row.Cells[3].Controls.Add(lb);
}
else
{
Label lbl = new Label();
lbl.Text ="Not available";
row.Cells[3].Controls.Add(lbl);
}
}
i++;
}
}
catch (Exception a)
{
}
}
protected void lnkBtnBookTheSelected_Click(object sender, CommandEventArgs e)
{
Session["SelectedID"] = e.CommandArgument.ToString();
lblUserMsgForPurpose.Text = "Dear " + Session["UserName"].ToString() + ", Please enter for what purpose you want to Booking";
ModalPopupExtenderPurpose.Show();//popup for some input
}
使用LinkButton在客戶端openPopup是相當糟糕的想法.. 爲您的願望,您可以發送ajaxRequest到服務器以保存會話中的變量。並在請求結束後立即打開彈出框 –