Click here to Skip to main content
15,899,542 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Friend,
I need you help for bellow situation.
Currently i am using
WebGrid
which display data dynamically using Dataset.
Now i want add a additional column to have a button say Edit/Delete, how can i achieve this.
My code is bellow

@{ var grid = new WebGrid(ViewBag.SampleList, canPage: true, rowsPerPage: 250, canSort: true); @grid.GetHtml(tableStyle: "gridtable", headerStyle: "GridHeader", footerStyle: "GridEvenRow", rowStyle: "GridEvenRow", alternatingRowStyle: "GridOddRow") ; }


What I have tried:

I have add column but it display added column only , not all previous column.
Posted
Updated 9-May-17 0:03am

1 solution

Hi, please click the link below & see the step 4.

Create an Editable WebGrid in MVC4 to Implement CRUD Operations[^]

You have to add columns like this :
columns:  
     grid.Columns()
 
Share this answer
 
Comments
Mukesh Ghosh 9-May-17 6:37am    
See my data populate dynamically. So don't have control on that. I just want to add additional column without hampering original in view itself.
deepankarbhatnagar 9-May-17 7:42am    
Check this,
http://www.c-sharpcorner.com/code/2910/mvc-web-grid-using-dynamic-data-table.aspx

worked dynamically

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900