目前還不清楚什麼是正確的語法,我已經嘗試過一些例子,但沒有運氣,這是我當前的按鈕代碼工作,我需要它保持作爲在新窗口/新標籤MVC按鈕應該在新窗口/標籤頁中打開url
<input type="button" title="Read" value="@T("Account.DownloadableProducts.Read")" onclick="location.href='@Url.Action("GetDownload", "Download", new { orderItemId = Model.DownloadMappingIds[product.Id].guid })'" />
感謝
太好了。對於我們其他人不太瞭解MVC,「aa」和「bb」是什麼?您應該擁有像@ Url.Action(「Read」,「MyController」,new {id = @ id})。對不起,只是我的寵物,人們認爲我們知道的東西馬上,而不是完成的例子。 – vapcguy
對此的一種變化:這可能會變得更加混亂,但不是@ Url.Action,您可以只說'data-myurl =「/ OtherBranch/Index?id = @ id」'並將其重定向到'myfunction ()'''var newUrl = window.location.href.split('/ FirstBranch')[0] + e.attr('data-myurl');' – vapcguy