Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening .aspx file as partial view of cshtml in asp.net mvc

I try to use ReportViewer in my MVC app.

I Have View that have button :

<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>

Aspx File as partial view :

@Html.Partial("ReportViewer")

And code to handle button click :

<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>

My 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>

When i try to run this code and hit button just error show and say that javascript have errors. I have checked it 10 times and don't see any. What i do wrong ?

Thanks

like image 335
Aht Avatar asked Nov 30 '25 23:11

Aht


1 Answers

It seems there is additional "," at the end of this 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
        }**,**
    });

Also add type to script tag like this :

<script type="text/javascript" >
like image 167
Midineo Avatar answered Dec 03 '25 15:12

Midineo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!