我对我有一个非常敏感的未解决的错误。 请看看这个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到服务器以保存会话中的变量。并在请求结束后立即打开弹出框 –