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

Dropdown list in Webgrid

Can somebody help me how can I put a dropdownlist in my webgrid column. I need to bind my dropdown list to a list from Model. And need to select an item from the list for every corresonding record in the grid. And I should be able to post selcetd…
3
votes
1 answer

Dropdownlist in WebGrid - MVC4

Can someone tell me what I am doing wrong in the View for Dropdownlist? I think it is expecting SelectList for dropdownlist? Thank you in advance. My Model: public class AppointmentModel { public int CustomerID { get; set; } …
rk1962
  • 1,713
  • 3
  • 24
  • 29
3
votes
1 answer

How can the View be aware of what page the ajax MVC WebGrid is on?

I have a view that contains a partial view containing a WebGrid that pages via ajax. However, I am having trouble getting the parent view to be aware of what page the WebGrid is on. What I'm trying to accomplish is this: I have a "create" button on…
anyeone
  • 251
  • 1
  • 4
  • 14
3
votes
2 answers

How to bind data to Grid in MVC3?

For past few days I had been working with MVC... I have to show a bunch of data in a grid...these all days I managed to show it in a table but my requirement is to bind it to jquery grid or Webgrid... I am stuck with this I don't know how to do…
SoftwareNerd
  • 1,875
  • 8
  • 29
  • 58
3
votes
1 answer

Bind WebGrid form AJAX

I'm a newbie to MVC3 and Razor and I need help on binding/loading a WebGrid once data is returned from AJAX post. Any help would really be appreciated (project due date quickly approaching) ;) My scenario is this: I have two cascading drop down…
GamerDev
  • 2,006
  • 4
  • 24
  • 31
3
votes
1 answer

Refreshing a MVC3 / MVC4 WebGrid without losing current page / filter

I have a WebGrid bound to a Plain Class Object. Nothing Fancy. The Grid features some paging and is used to display a list of users. The Last column of the Grid is an Ajax Action Link which fires a Pop Up DIV with some Edit Controls. On completion…
Ben Pretorius
  • 4,079
  • 4
  • 34
  • 28
3
votes
1 answer

Losing web controls data when navigating from one page to other in webgrid which is in aspx page

Hi I had a webgrid in my aspx page with paging, when I try to navigate from one page to other page in the webgrid. I am losing data of other controls in aspx page. Basically the webgrid when navigating from one page to other its trying to reload the…
user1257832
3
votes
3 answers

ASP.NET MVC 3 Custom sorting a WebGrid with ascending, descending options

Helo, I am working on an ASP.NET MVC 3 application. I have a View var grid = new WebGrid(rowsPerPage: 10, ajaxUpdateContainerId: "GridDiv",canPage: true,canSort: true); grid.Bind(source:…
Y2theZ
  • 10,162
  • 38
  • 131
  • 200
2
votes
2 answers

Webgrid - Column header not clickable

I have a webgrid with a date column. The date should appear as a link, plus the column should be sortable too. If I add the date column like below, the column header "Order Date" is coming up as plain text. grid.Column( header: "Order Date", …
user471317
  • 1,231
  • 2
  • 22
  • 35
2
votes
1 answer

web grid sorting not working mvc 3 razor

I am using MVC 3 with Razor and I am using the below web grid to show some data, What I need sorting on my first column. I have used similar code on other pages too for my sorting and it works fine, but here it doesnt seem to work. However if I go…
Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281
2
votes
3 answers

Select Row in WEBGRID

How can a select a Row of a WEBGRID after binding it so that row will get highlighted(by mouse click on any row or cell of any row without the use of check-box or option button as column) 1.)After selecting any row can I get the data value for that…
MindGame
  • 1,211
  • 6
  • 29
  • 50
2
votes
0 answers

How to hide asp.net mvc3.0 webgrid column dynamically?

I have used a ASP.NET MVC 3.0 web grid to display the following data: Account ID Account Name AccountCode Enabled : Yes or No Based on the "Enabled" , I need to change the color of the row. I dont need to display that column to the user. Though…
Chakri
  • 151
  • 2
  • 13
2
votes
2 answers

Formatting WebGrid Column to Contain Two Pieces of Data

I am trying to format a WebGrid column so I can concatenate two pieces of data together (first and last name). Here is what I'm trying, but I will admit I don't think I fully understand how to use the data (besides the basic scenarios) in WebGrid.…
JasCav
  • 34,458
  • 20
  • 113
  • 170
2
votes
3 answers

MVC3 WebGrid - Creating Columns Dynamically (foreach?)

I want to create a WebGrid with columns based on a collection, such as List. Something like this (which obviously doesn't work): @grid.GetHtml( columns: grid.Columns( @foreach (var column in Model.ListOfColumns) { …
pfeds
  • 2,183
  • 4
  • 32
  • 48
2
votes
1 answer

MVC3 Ajax.ImageActionLink within WebGrid

I am trying to populate a WebGrid cell with an image that will open up a "Details" popup based on which row is selected. Currently, I have this for the details column: grid.Column(header: "Details", format: (item) => @Ajax.ActionLink("pop",…
Sean C
  • 23
  • 1
  • 4