0

当我单击以下按钮时,它会打开页面两次。我似乎找不到错误:

.cs 文件:

protected void Page_Load(object sender, EventArgs e)
{ 
     if (!Page.IsPostBack)
     {
         btnPrint.Attributes.Add("onclick", "openWindow(" + Request.QueryString["cId"].ToString() + "," + Request.QueryString["aId"].ToString() + ");");
     }
}

的JavaScript:

<script type="text/javascript">
    //Function To Open A New Window To View the selected PDF
    function openWindow(cId, aId) {
        window.open("printMe.aspx?cId=" + cId + "&aId=" + aId + "", "", "", "");
    } 
</script>

和 aspx 中的按钮:

<dx:ASPxButton ID="btnPrint" runat="server" Image-Url="~/images/print.bmp" ToolTip="Printer Friendly Page">
</dx:ASPxButton>
4

1 回答 1

0

像下面这样更改javascript解决了这个问题。我不是javascript专家。

<script type="text/javascript">
    //Function To Open A New Window To View the selected PDF
    function openWindow(cId, aId) {
        window.open("printMe.aspx?cId=" + cId + "&aId=" + aId,"mywindow");
    } 
</script>
于 2013-10-31T07:21:54.723 回答