[英]Issue opening .aspx page in a new window from inside an ajax modal popup
I am trying to open an preview.aspx page in a seperate window from INSIDE an ajax modal popup. 我正在尝试从INSIDE和ajax模式弹出窗口的单独窗口中打开preview.aspx页面。 I have tried doing it with client side scripting using the onClientCLick preview.target _blank etc but this doesn't work at all.
我尝试使用onClientCLick Preview.target _blank等客户端脚本进行此操作,但这根本不起作用。 I have now managed to at least get this working within my lbPreview_Click routine but this requires a 2nd click because i am using the Attributes.Add to open window (the only way it would work so far!):
现在,我至少设法在lbPreview_Click例程中使它正常工作,但是这需要第二次单击,因为我正在使用Attributes.Add打开窗口(到目前为止唯一有效的方法!):
protected void lbPreview_Click(object sender, EventArgs e)
{
string recordNo = lblRecordNo.Text;
string details = txtQuery.Text;
string reason = ddReason.SelectedItem.Text;
string fullName = lblFullName.Text;
string path = "emailPreview.aspx?recordNo=" + recordNo + "&details=" + details + "&reason=" + ddReason.SelectedItem.Text + "&fullName=" + fullName + "";
lbPreview.Attributes.Add("onClick", "window.open('" + path + "');");
}
PLease note: I don't have the values to build my url path until the button has been clicked, so calling the details on page load or similar won't work either. 请注意:在单击按钮之前,我没有值可用来构建我的url路径,因此调用页面加载或类似内容上的详细信息也不起作用。
Any suggestions/help would be very much appreciated. 任何建议/帮助将不胜感激。
Kind Regards, ukjezza. 亲切的问候,ukjezza。
You should use java-script to lookup into control values to build the URL and then open the window. 您应该使用Java脚本查找控制值以构建URL,然后打开窗口。 For example, consider following js function on aspx page
例如,考虑在aspx页面上执行以下js函数
function openPreview() {
var recordNo = document.getElementById('<%= lblRecordNo.ClientID %>').innerHTML;
var details = document.getElementById('<%= txtQuery.ClientID %>').value;
var reason = document.getElementById('<%= ddReason.ClientID %>').value;
var fullName= document.getElementById('<%= lblFullName.ClientID %>').innerHTML;
var url = "emailPreview.aspx?recordNo=" + recordNo + "&details=" + details + "&reason=" + reason + "&fullName=" + fullName;
window.open(url);
}
Should be invoked on click of your preview button/link. 应在单击预览按钮/链接时调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.