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

WebGrid MVC 5 – Show action buttons based on Authentication and Authorization

In the WebGrid last column has 3 buttons “create, edit, delete”. As indicated in the title I want to show only “edit” and “delete” buttons if the user is authenticated and authorized. If the link is not in the WebGrid, for example “Add” button I…
Dush
  • 1,185
  • 26
  • 29
3
votes
1 answer

How to refresh a MVC webgrid without calling the controller

On page load my model gets passed in with a List of Event logs from a machine. I declare a list and then fill it with those logs. private List _logObjList = new List(); which gets filled up via this: @helper…
Bash
  • 61
  • 5
3
votes
1 answer

How to change the colour of an MVC webgrid row text depending on some condition

I'm new to MVC, kindly guide me. I need to change the text color of webgrid row based on conditions. As stated I'm new to MVC so I'm not sure where to start and handle this. Below is the View @model …
Lord-David
  • 535
  • 1
  • 11
  • 34
3
votes
1 answer

Parsing Dynamic SQL in C# and binding to WebGrid in ASP.Net MVC

Parsing Dynamic SQL in C# and binding to WebGrid in ASP.Net MVC I have dynamic SQL Queries that uses pivot to produce result and the resultset may be like this.: Name Div1 Div2 Div3 Div4 Div5 Active 1 0 0 0 0 Busy 0 0 …
Pawan Shukla
  • 75
  • 2
  • 9
3
votes
2 answers

MVC 4 WebGrid edit row with a button

I have a webgrid, what I want to do is to edit the selected row, but I want this action to be performed when the user press a button and not only when the user select the row. How can I do this??
Sergio
  • 53
  • 1
  • 1
  • 6
3
votes
1 answer

Webmatrix - WebGrid: change css style conditionally

I've just started with Webmatrix and I'm trying to transform an HTML table to the webgrid. The data comes from the DB and I want to change the css class for each td (within one column) depending on the items content. So for example if the item…
Tony Clifton
  • 703
  • 3
  • 14
  • 27
3
votes
1 answer

Infragistics WebHierarchicalDataGrid Unable to determine when a child row is selected and then how to get the data that is selected

I have dragged a WebHierarchicalDataGrid to the page and have told it not to autogenerate bands or autogenerate columns. Enable Ajax is unchecked. Via codebehind, I manually created the columns on the grid for both the parent and child tables. I…
user2360842
  • 33
  • 1
  • 5
3
votes
3 answers

MVC 4 WebGrid and Jquery produces two errors. JQuery is undefined and a sort error after ajax model change

Inside my div element I am updating is a page partial with a webgrid and when I specifiy ajaxUpdateContainerId: in the webgrid constructor I get the error: JavaScript runtime error: 'jQuery' is undefined Here is the generated javascript the error…
Xaxum
  • 3,545
  • 9
  • 46
  • 66
3
votes
2 answers

ASP.NET MVC 4 - WebGrid. How retaining page after the Edit

I'm using WebGrid on my project, I have implemented the paging / Edit and Delete option. At the moment, when I'm deleting and editing an item, I'm going back to the first page. But, I would like to return (Back to list) at the same page. Do you have…
fix105
  • 234
  • 1
  • 6
  • 16
3
votes
3 answers

Asp.net MVC WebGrid in partial view not updating through Ajax

I have 2 WebGrids each in a different partial view, displaying on a View Page. All is working fine but when I do sorting or pagination on WebGrid, it's not updating through ajax. What am I doing wrong? PartialView1: <%@ Control Language="C#"…
Dhwani
  • 7,484
  • 17
  • 78
  • 139
3
votes
3 answers

webgrid reference is not found in view

I'm trying to do a basic implementation of the asp.net mvc webgrid mentioned in this tutorial: http://msdn.microsoft.com/en-us/magazine/hh288075.aspx I'm using asp.net mvc 4. Upon doing a simple reference to the grid (the first part of the…
gleasonomicon
  • 1,069
  • 5
  • 13
  • 24
3
votes
1 answer

Format WebGrid in CSS FIle

I have a webgrid in one of my view. I want to add some style properties but it does not work when I add these in the project's css file. However, when I add it withing the style tag in the view, it works. Also, all other elements of the view get…
jpo
  • 3,959
  • 20
  • 59
  • 102
3
votes
2 answers

Sorting order icons. How to modify WebGrid header in one place?

I should add sorting order icons to Ajax WebGrid. The following approach works: grid.Column("Name", string.Format("Name {0}", grid.SortColumn == "Name" ? grid.SortDirection == SortDirection.Ascending ? "▼" : "▲" : "") But should be applied to every…
user1894689
  • 33
  • 1
  • 3
3
votes
1 answer

Submitting Form with Jquery submitting Get instead Post

I am using WebGrid in My MVC application , for paging I am using this code var links = $('a[href*=page], a[href*=sort]'); form = $('form')[0]; links.click(function () { debugger; form.attr("action",…
StringBuilder
  • 1,619
  • 4
  • 32
  • 52
3
votes
0 answers

Ajax-jquery update of WebGrid in ASP.net web pages

I have a grid and a form in an ASP.NET web page (Razor v2 not ASP.net Web Forms). I have written a query to retrieve data from the database and used WebGrid to display the data in a grid format. For the form, I have used jQuery to insert the form…
Web Pogrammer
  • 117
  • 2
  • 9