Html.ActionLink in a button
- by Pomster
I Am trying to connect to a method in my controller, with a button. I can connect though this link:
@Html.ActionLink("Print", "Print", new { id = Model.SalesContractId})
But i Don't want a link, i want my button on my dialog to do it. I have tried the following:
$('#btnDialogPrint').click(function () {
location.href = '<%= Url.Action("Print", "Print", new { id = Model.SalesContractId}) %>';
});
But it just redirect me to a page that say bad request.
namespace Contract.Controllers
{
public class ContractController : Controller
{
CompassEntities db = new CompassEntities();
public ActionResult Print(int id)
{
return View(""); // This can be removed and Print code may be added
}
Don't worry about the code inside i will get to that once i get inside this method.
Could i maybe attach a link here?
<input type="button" value="Print" id="btnDialogPrint" />