Opening a new window with a button?

Pomster picture Pomster · Jun 14, 2012 · Viewed 17.7k times · Source

I need to open a new window for my printing can any one let me know how to do this?

My button Click code:

My window.location works, but cant use the window.open

$('.btnFromIndexPrint').click(function () {
    if (document.URL.indexOf('index') > -1) {
         // window.location = '../Print/' + $(this).attr('id');
         window.open = '../Print/' + $(this).attr('id');
    } else {
        //window.location = 'Contract/Print/' + $(this).attr('id'); //Redirect  from Index page to print action
        window.open = 'Contract/Print/' + $(this).attr('id');
    }

});

My html:

I know there is something called target ="blank" id don't think it will work though.

<input type="button" value="Print" class="btnFromIndexPrint" id="@item.SalesContractId"/>

How would i open a redirect on a new page?

Important!!!!!!!

return RedirectToAction("Print", new { id = contractInstance.SalesContractId });

Answer

Sudhir Bastakoti picture Sudhir Bastakoti · Jun 14, 2012

should be:

window.open(url_or_your_page);

See: Example