I have in a page more partial views
rendered.
This is how the page looks:
I need to handle to onclick
event for the button Create Invoice
<div class="row">
<div class="button-bar col-md-2">
@Html.ActionLink(@Resources.Common.ShowInvoice, "EditLotDamage", "TimberMonitor", new { Id = 0, LotId = ViewBag.Id }, new { @class = "btn btn-success" })
</div>
<div class="button-bar col-md-2">
@Html.ActionLink(@Resources.Common.CreateInvoice, "EditLotDamage", "TimberMonitor", new { Id = 0, LotId = ViewBag.Id }, new { @id = "InvoiceDamageButton", @class = "btn btn-success", onclick = "validate" })
</div>
</div>
The buttons are on a partial view
with name: LotDamageButtonBarPartial
, which is rendered from another partial view like this:
........
tabDamage.SetContent(() =>
{
if (ViewBag.CanModify)
{
Html.RenderPartial("LotDamageButtonBarPartial");
}
Html.RenderAction("LotDamageListPartial", new { LotId = ViewBag.Id });
});
........
I have tried to handle the onclick event like this in the main page:
$(document).ready(function () {
$('#InvoiceDamageButton').click(function ()
{
alert("test");
});
});
but it is not working. Can you advise?