CS中打开前端的页面

48 阅读1分钟
private CWC.PagePanel htmlPanel { get { return Page.FindCamstarControl("Control") as CWC.PagePanel; } }

 protected void btnSearch_Click(object sender, System.EventArgs e)
        {
            var gridData = jqDetail.GridContext.GetSelectedItems(false);
            if (gridData == null || gridData.Length == 0)
            {
                Page.DisplayMessage(new ResultStatus("没有选择行", false));
                return;
            }
            PDFDetail row = gridData[0] as PDFDetail;
            ViewDMSDoc(row.Identifier);
        }
        private void ViewDMSDoc(string DMSURL)
        {
            string _url = DMSURL;
            CWC.HTMLPanel t = new CWC.HTMLPanel();
            t.HTMLText = "<!DOCTYPE html>";
            t.HTMLText += "<html lang=\"en\">";
            t.HTMLText += "  <head>";
            t.HTMLText += "    <meta charset=\"UTF-8\" />";
            t.HTMLText += "    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />";
            t.HTMLText += "    <meta name=\"viewport\" content=\"width =device-width, initial-scale=1.0\" />";
            t.HTMLText += "    <title>pdf预览</title>";
            t.HTMLText += "  </head>";
            t.HTMLText += "  <body>";
            t.HTMLText += "    <a target=\"_self\" class=\"media\" href=" + DMSURL + "></a>";
            t.HTMLText += "  </body>";
            t.HTMLText += "</html>";
            t.HTMLText += "<!-- 引入网盘下载好的两个js,要注意引入顺序 -->";
            //t.HTMLText += "<script type=\"text/javascript\" src=\"../ plugin / jquery - 2.2.1.min.js\"></script>";
            //t.HTMLText += "<script type=\"text/javascript\" src=\"../ plugin / jquery.media.js\"></script>";
            t.HTMLText += "<script>";
            t.HTMLText += "  $(function () {";
            t.HTMLText += "     $(\".media\").media({ width: '100%', height: '500px'});";
            t.HTMLText += "   });";
            t.HTMLText += "</script>";



            SWC.Panel tt = new System.Web.UI.WebControls.Panel();
            tt.Controls.Add(t);
            htmlPanel.Controls.Add(tt);

            //Page.ClientScript.RegisterStartupScript(Page.GetType(), "", $"window.open('{_url}')");

            //------------------------------
            ScriptManager.RegisterStartupScript(this, this.GetType(), "", $"window.open('{_url}')", true);
            CamstarWebControl.SetRenderToClient(htmlPanel);
            //-----------------------------------
        }

image.png

image.png