Questions tagged [webgrid]

WebGrid is a view control built in to the ASP.NET Web Pages Framework. It displays a sortable, pageable HTML grid given a collection, and is customizable in various ways, making use of .NET 4.0's "dynamic" object type.

The ASP.NET Web Pages WebGrid provides a kind of quick-scaffolded functionality for displaying tabular information in ASP.NET Web Pages, or ASP.NET MVC when using the Web Pages (Razor) view engine. Given an IEnumerable data source, it is possible to construct a functional HTML data table, with sorting and paging, with a single line of code in the View (Razor syntax, for example):

@( new WebGrid(data).GetHtml() )

The control offers customization of various styling, sorting, and paging functionality; as well as the ability to define the column contents either as raw data, or as templated HTML.

822 questions
5
votes
4 answers

MVC3 razor Webgrid paging and sorting with more than 2000 records

I am using a webgrid similar to the one mentioned here @{ var grid = new WebGrid(canPage: true, rowsPerPage: ThisController.PageSize, canSort: true, ajaxUpdateContainerId: "grid"); grid.Bind(Model.Employees, rowCount: Model.TotalRecords,…
Millar
  • 1,095
  • 6
  • 16
  • 34
4
votes
1 answer

Paging/Sorting not working on web grid used in Partial View

I have a partial view where I am showing a web grid depending upon a value selected from a page. For drop down I have used @Html.DropDownListFor( x => x.ItemId, new SelectList(Model.Items, "Value", "Text"), new { id = "myddl", data_url =…
Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281
4
votes
1 answer

ASP.NET MVC3: WebGrid + Ajax Filters + Ajax Sorting & Paging

Basically, I'm using WebGrid and I need to filter the results. The first problem I have here is it's my first time using WebGrid and I was hoping some of you could give me a hand with it... So far, I've managed to sort grid results and filter them…
met.lord
  • 618
  • 2
  • 9
  • 35
4
votes
2 answers

Asp Mvc3 webgrid Paging and Filtering by ajax

I Have a little problem with WebGrid control for Asp.Net MVC3. What I want is to perform a search view using ajax and webgrid; something like this: Search Criteria ______________________________ Subject: _____ Task Type: _____ SUBMIT…
argame88
  • 67
  • 1
  • 2
  • 6
4
votes
2 answers

How do you hide a column for a hidden field within a webgrid using ASP.Net MVC3?

How would I hide a column that should be hidden from view. I handled this by hiding the object, but the column still shows in the UI as a skinny column with nothing in the rows. Is there way to prevent the item from being drawn? grid.Column(null,…
kermitforney
  • 93
  • 2
  • 4
4
votes
1 answer

Asp.Net MVC WebGrid helper custom attributes for table rows

Is there a way to assign custom data attributes for table rows generated by the WebGrid helper in Asp.Net MVC? What I would like to end up with is something like this:
e11s
  • 4,123
  • 3
  • 29
  • 28
4
votes
1 answer

Server side paging for MVC3 Webgrid

I have looked at a number of examples (e.g. http://www.dotnetcurry.com/ShowArticle.aspx?ID=618 and http://msdn.microsoft.com/en-us/magazine/gg650669.aspx) but it seems very manual and convoluted. The reason I would like to use the WebGrid is that…
Peter Munnings
  • 3,309
  • 1
  • 30
  • 43
4
votes
2 answers

Adding custom html to Header in WebGrid

I'm trying to add a custom header for an MVC3 WebGrid. The header property only allows for string, and any HTML is escaped. My current grid razor view is as follows: var grid = new WebGrid(Model, canPage: true, rowsPerPage: 5); …
harry mohammed
  • 41
  • 1
  • 1
  • 2
4
votes
1 answer

Is the MVC WebGrid Open Source?

Is the MVC WebGrid Open Source? If so where can I find the source code. The current version of the WebGrid has little to no documentation, incomplete implemtation etc. I am trying to do a simple thing as adding a visibility property to the…
Tawani
  • 11,067
  • 20
  • 82
  • 106
4
votes
2 answers

ASP.NET MVC3 WebGrid Helper and Model Metadata

I'm trying to use the WebGrid html helper in ASP.NET MVC 3 to autogenerate the columns according to the information found in the ModelMetadata. For example the code in a view that accepts a list of objects would be: var grid = new…
kkara
  • 811
  • 1
  • 10
  • 11
4
votes
2 answers

Add Multiple WebGrids with Styles in One Page without Redundancy

Basically, here's my code inside the view and I don't want to repeat WebGrid instances. My Model public class UsersWithDetailsModels { public IEnumerable ApplicationUsers { get; set; } public IEnumerable
Xtravagant
  • 121
  • 8
4
votes
2 answers

MVC WebGrid renders AJaX script before its table. How to force the generation of script in script section

I have a WebGrid in my Razor View. It's performing its task well like paging and sorting. Now I need to make the paging and sorting in ajax call, so I assigned it an ajaxUpdateContainerId. Now When grid.GetHtml() method is called, it's rendering…
Anup Sharma
  • 2,053
  • 20
  • 30
4
votes
2 answers

Approaches to have a responsive asp.net web Grid for mobile user interface (using block display versus hiding some columns)

I am working on an asp.net mvc-4 web application and I am using bootstrap 2.0. Currently I am heavily using the asp.net mvc web grid, in almost every controller. Now it is a great way to sort, page and view info with minimal code written. But the…
John John
  • 1
  • 72
  • 238
  • 501
4
votes
3 answers

How to add a hidden field inside webgrid column in MVC action

I want to create hidden field in Webgrid PollId column which i am exactly not sure how to add some extra fields in this scenario public ActionResult Index(string mode) { List columns = new List(); …
Imran Luhur
  • 447
  • 3
  • 15
4
votes
0 answers

How to get the WebGrid selected row ID-value sent to controller?

I have researched and cannot find an answer that I can use to pass the ID value back to the controller when user clicks on the SELECT cell of a WebGrid row using mvc4 asp.net vs2012. My WebGrid looks like this in the (partial) view: @{ …
John D
  • 517
  • 7
  • 22