Question

It's not clear what the proper syntax should be, and i tried some examples already but with no luck, this is my current button code that working and i need it to stay as a button when clicked open the action in new window/ new tab

<input type="button" title="Read" value="@T("Account.DownloadableProducts.Read")" onclick="location.href='@Url.Action("GetDownload", "Download", new { orderItemId = Model.DownloadMappingIds[product.Id].guid })'" />

thanks

Was it helpful?

Solution

you can do this using javascript function

 <input type="button" value="MyButton"  onclick="myfunction(this)" 
 data-myurl="@Url.Action("aa", "bb", new { id=@id})"  /> 


  <script>
   function myfunction(e)
     {
     var url = $(e).data('myurl');
     var popupWindow = window.open(url,title,'scrollbars=1,height=650,width=1050');
    }
  </script>

OTHER TIPS

I have been struggling with this for a while, the solution was to, instead of target="_blank", you should use formtarget="_blank".

Thanks!

I'm struggling to read your question and code but to open new windows, the following code is used:

target = "_blank"

Is it possible to tidy your question up a bit and then I'll be able to assist you further.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top