【发布时间】:2019-02-19 23:40:03
【问题描述】:
我有这个问题,我正在尝试通过模式弹出窗口来解决。当我从后面的代码中调用弹出窗口时。该链接不显示嵌入的 pdf 文件,只是空白的嵌入黑屏。
但是,当我将嵌入标签从模式弹出窗口中取出并根据后面代码的响应显示它时,pdf 文件会显示在屏幕上。所以我知道这条路是对的。我尝试在 pdffile.src 之后的代码中调用模态弹出窗口,但响应没有变化。
<script>
function ShowPopup() {
$(function () {
$("#displaypdf").dialog({
modal: true,
height : 800,
width : 800,
});
});
return false;
};
</script>
<div id="displaypdf" style="display:none">
<embed id="pdffile" class="pdfsource" runat="server" />
</div>
protected void SelectButton_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup();", true);
string DirPath = Request.QueryString["Dir"];
Button btnButton = sender as Button;
GridViewRow gvRow = (GridViewRow)btnButton.NamingContainer;
Label SelectLink = (Label)gvRow.FindControl("SelectLink");
pdffile.Src = "file:Z:/testdirectory/" + DirPath + "/" + SelectLink.Text;
}
【问题讨论】: