I have a following Razor code and would like to add button as the 3rd column.
Clicking the button would need to call Controller/Action method.
How to achieve this?
Thanks
Hwan
@( Html.Infragistics().Grid(Model) .ID("grid1") .Columns(column => { column.For(upgrade => upgrade.FirstName).HeaderText("First Name").Width("100px"); column.For(upgrade => upgrade.LastName).HeaderText("Last Name").Width("100px"); }) .Features(features => { features.Selection().Mode(SelectionMode.Cell).MultipleSelection(true); }) .Height("500px") .DataSourceUrl(Url.Action("GetData")).DataBind().Render())
Hello Hwan,
Thank you for posting in our community.
Inserting a button in igGrid column could be achieved by using Column Templates. I believe you will consider the following article from our documentation, explaining how a basic column template could be created, useful:
http://help.infragistics.com/Help/Doc/jQuery/2012.1/CLR4.0/html/Creating%20a%20Basic%20Column%20Template%20in%20the%20igGrid.html
Additionally, a working sample that shows how to insert a button into column using igGrid column template functionality. In the most right column in the grid there is button for each row. Pressing a button delete its containing row.
http://www.igniteui.com/grid/column-template
The same could be achieved in MVC project using .Template property when defining the columns of the grid.
I hope you find this information helpful.
Please let me know if you need any further assistance with this matter.
Please let me know if you have any additional questions regarding this matter.