Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Guys,
I wanna know how does one open the page created in razor framework using the window.opener in javascript.
Paige
Posted

1 solution

You could use a normal link with target="_blank" attribute:

C#
@Html.ActionLink(
    "Generate PDF",
    "GeneratePdf",
    "MyController",
    null,
    new {
        url = "some url",
        target = "_blank"
    }
)



or if you want a button you could use javascript in separate JS file you can use Jquery:


C#
$(function() {
    $('#btnID').click(function() {
        // get the url of the data-pdf-url property of the button
        var url = $(this).data('data');
        window.open(url, 'data');
        return false;
    });
});
 
Share this answer
 
Comments
Mninawa 8-Sep-11 2:55am    
Thanx
Syed Salman Raza Zaidi 8-Sep-11 3:01am    
Kindly accept the solution and give ratings :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900