I'm using an igGrid in ASP.NET MVC (Javascript).
This is my code:
$("#gridPpm").igGrid({ autoGenerateColumns: false, width: "100%", columns: [ { headerText: "Ppm Id", key: "PpmId", dataType: "number", width: "55px" }, { headerText: "Vendor", key: "Vendor", dataType: "string", width: "200px" }, { headerText: "Total PPM", key: "TotalPpm", dataType: "number", width: "110px" }, { headerText: "Internal Stop", key: "InternalStop", dataType: "number", width: "130px" }, { headerText: "Customer Stop", key: "CustomerStop", dataType: "number", width: "140px" }, { headerText: "Score Price", key: "ScorePrice", dataType: "number", width: "130px" }, { headerText: "Timestamp", key: "DtTimestamp", dataType: "string", width: "140px" }, { headerText: "Actions", key: "Actions", dataType: "string", template: "<input type=\"button\" value=\"View\" data-id=\"${Id}\" class=\"btn btn-fremach-gr\" onclick=\"location.href = '@Url.Action("ViewPpm", "SupplierEvaluation", new { PpmId })'\"/>" } ], dataSource: ds.dataView(), responseDataKey: "results", features: features });
I have a button in the Template where I want to go to an action in my controller when clicked on. Here I have to pass the PpmId for this row. How do I do that here? Is this possible?
Hello Ronny,
I am glad that you managed to achieve your requirement. Thank you for taking time to share your solution with the community.
Please do not hesitate to contact me if you need any further assistance with this matter.
I found the solution.
I changed the template to:<input type=\"button\" value=\"View\" data-id=\"${Id}\" class=\"btn btn-fremach-gr\" onclick=\"location.href = '/SupplierEvaluation/ViewPpm/${PpmId}'\"/>
This works!