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
0
votes
1 answer

Syntax complicated column in webgrid

The column that i want to accomplish has 3 possible outcomes. The paidDate is NOT empty --> just show the paiddate The paidDate is empty and the dueDate < NOW --> shows: paidDate / "with reference" / reference + add a class "green" The paidDate is…
thomvlau
  • 602
  • 3
  • 9
  • 24
0
votes
1 answer

MVC WebGrid - Set Column Width

I'm trying to set the width of a column in an MVC WebGrid (last column) but despite applying a class within the grid.column declaration (shown in the code below), the width does not change. The class is successfully applied in the html, but only to…
Simon Barnett
  • 69
  • 2
  • 9
0
votes
2 answers

How to display row details on click from WebGrid MVC4 using JQuery, AJAX

I'm new to ASP.NET MVC3. I'm currently building a site to display a list of Faxes that we received. I have the model, controller and the view working correctly. I also have the row selection enabled. The problem that I'm experiencing is in…
user1828605
  • 1,723
  • 1
  • 24
  • 63
0
votes
2 answers

How do I dynamically add an Actionlink from the Controller in MVC 4

[HttpGet] public JsonResult EfficientPaging(int? page = null, string searchParam = null) { int skip = page.HasValue ? page.Value - 1 : 0; _users = db.Users.Select(u => u).ToList(); var data = _users.Skip(skip *…
kyle
  • 527
  • 6
  • 21
0
votes
2 answers

Count the tr's in a table? (WebGrid)

I have a table and I would like to check if it populates or not. Below I've shown how I build the grid and how it looks in the run time environment; how would I count the rows? How I build the grid: @using System.Dynamic @{ var result = new…
Pomster
  • 14,567
  • 55
  • 128
  • 204
0
votes
1 answer

JQuery UI datepicker is not working in Razor WebGrid edit mode

I'm trying to implement MVC 4 WebGrid in my application. In edit mode, I want to apply JQuery UI datepicker in textbox. In Javascript $(function () { $('.edit-mode').hide(); $('.edit-reg, .cancel-reg').on('click', function () { …
CMMaung
  • 165
  • 5
  • 11
  • 27
0
votes
1 answer

WebGrid data displayed inside first column

In my ASP.NET MVC application, I have a partial view which renders a table. My problem, in short, is that all the values of all the properties of each object in the WebGrid's data source are displayed inside the first column of the table, instead of…
ury
  • 1,050
  • 11
  • 22
0
votes
2 answers

CheckBoxFor in webgrid with model IEnumerable and T.boolValue

I've been strugling with getting a small thing to work. I want to display a checkbox for a specific field in my model. My view has a IEnumerable as the @model: @model IEnumerable @{ …
0
votes
1 answer

HTML is not getting rendered on WEBGRID

Webgrid is not rendering html, which is coming from sql for me. Please see my question below. Please help me as i am stuck in middle of it. SELECT DISTINCT r.ReportName AS [Report Name] ,r.ReportDesc AS [Report Desc] ,
Vijay Pote
  • 103
  • 1
  • 1
  • 7
0
votes
1 answer

Display webgrid with rowspan IN MVC

How to code webgrid as shown beloW in MVC 3. h1 | h2 | h3 ------------------- R11 | R12 | R13 |-------|------ | R22 | R23 ------------------- R22 | R21 | R23 |-------|------ | R22 | R33 Middle colmn and 3 rd…
Sameer More
  • 589
  • 1
  • 6
  • 13
0
votes
1 answer

Keep current page when sorting in @grid.GetHtml

Is there any way to keep current page when sorting @grid.GetHtml columns? For now I have this public virtual ActionResult Users(int? page) { var model = _context.Users(); return View(model); } and HTML @{ var grid = new WebGrid(source:…
NoWar
  • 36,338
  • 80
  • 323
  • 498
0
votes
1 answer

C# MVC - Keep sort direction, column and paging in Webgrid alive when deleting a item?

Is it a good way to use routed values for column name, page and sort dir or are there better ways to keep the webgrid settings alive? Currently it looks like this: @Html.ActionLink("Delete", "DeleteEntry", new { id = item.Id, sortdir, sort =…
Jannik
  • 2,310
  • 6
  • 32
  • 61
0
votes
1 answer

MVC C# WebGrid sort failing

I have a WebGrid sort that is not doing anything upon clicking the headers. The WebGrid is contained within a Partial View that looks like this - @model MyModel var grid = new WebGrid(Model.MyList, defaultSort: "MyField", canSort: true,…
A Bogus
  • 3,852
  • 11
  • 39
  • 58
0
votes
2 answers

implement row number in mvc3 webgrid along with paging?

i want to autogenerate rownumber for webgrid and im able to do it with the below code grid.Column(header: "RowNumber", format: item => item.WebGrid.Rows.IndexOf(item) + 1), the problem with this is that, im also implementing paging for my grid and…
Harry
  • 41
  • 1
  • 2
  • 5
0
votes
2 answers

Webgrid ,first td should be diffrent

I am planing to use Webgrid of MVC3/MVC4 But all my rows in the table should have same column format except for the first one. In the first row there should be a text box that span all the columns of the table. All other rows should be populated…
Kuttan Sujith
  • 7,889
  • 18
  • 64
  • 95