我尝试在我的 MVC 应用程序中使用 ReportViewer。
我有一个有按钮的 View :
<button id="ReprintBol" class="button secondary right noPrint" style="display: inline-block; position: absolute; bottom: 0; right: 0">
<span class="noPrint" style="display: inline-block; padding: 0 0 0 10px; font-size: 11px; font-weight: bold;">Reprint</span>
</button>
作为局部 View 的 Aspx 文件:
@Html.Partial("ReportViewer")
处理按钮点击的代码:
<script>
$('#ReprintBol').click(function () {
$("#Test").dialog({
bgiframe: true,
resizable: false,
width: 700,
height: 400,
modal: true,
title: 'Note',
autoOpen: false,
draggable: true,
show: "blind",
hide: "blind",
bDestroy: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
});
$("#Test").dialog("option", "title", "Select Stops");
$("#Test").dialog("open");
});
</script>
我的aspx View
<div id="Test" style="display: none">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Height="509px" Width="1542px">
</rsweb:ReportViewer>
</form>
</div>
当我尝试运行这段代码并点击按钮时,只是错误显示并说 javascript 有错误。我已经检查了 10 次,但没有看到任何内容。 我做错了什么?
谢谢
最佳答案
似乎在这个 block 的末尾有额外的“,”:
$("#Test").dialog({
bgiframe: true,
resizable: false,
width: 700,
height: 400,
modal: true,
title: 'Note',
autoOpen: false,
draggable: true,
show: "blind",
hide: "blind",
bDestroy: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
}**,**
});
同时将类型添加到脚本标签中,如下所示:
<script type="text/javascript" >
关于c# - 在 asp.net mvc 中打开 .aspx 文件作为 cshtml 的部分 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35914254/