how to call a javascript function in Grid.MVC

1.1k Views Asked by At

I have MVC Grid and i want to render a actionlink so that onclick of the link a javascript function should call.I have tried this code but its not working please help here.. not working means on view click the page is without layout

enter image description hereenter image description here

@Html.Grid(Model).Named("receipt").Columns(columns =>
{


    columns.Add(c => c.PaymentDate).Format("{0:dd/MM/yyyy}").Titled("Date").Filterable(true);

    columns.Add(c => c.CustomerName).Titled("Customer").Filterable(true);

    columns.Add(c => c.TotalAmountApplied).Titled("Amount").Filterable(true);


    columns.Add().Encoded(false).Sanitized(false).Titled("View").Filterable(false).RenderValueAs(o => Html.ActionLink("see", null,null, new { onclick = "ViewReceipts('"+o.PayReceved_ID+"');" }));


}).WithPaging(@ViewBag.paging).Sortable(true)



<script type="text/javascript">

    function ViewReceipts(recId)
    {
      //do something here
    }

</script>
0

There are 0 best solutions below