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

Get Values of DropDownList which is inside webgrid and also each dropdown is an attribute of the model

I have a webgrid contains a dropdown which contains different items for each user(Items are grouped). I want to get the selected values to the controller . How can I do that. Heres my ; Model : public SelectList AvailableDevices { get; set; } View…
albatross
  • 455
  • 2
  • 8
  • 27
0
votes
1 answer

HtmlDropDownList SelectList is a list of Model and how to display models Property

I have a webgrid and inside it each item has different selectList which consist of model. I want to display name of that model. How can I do that grid.Column(header: "AvailableDevices", format: @item => Html.DropDownList("value",…
0
votes
0 answers

Jquery not carried over to next webgrid page in partial view

I am running into a problem with a webgrid I am creating in MVC. The grid is generated in a partial view that is updated via ajax form in order to not have to reload the entire page. The partial view itself is returned by a controller method. I…
0
votes
1 answer

How to handle embedded webgrid styling

I've got a sub Webgrid inside a webgrid that returns users per record...
@grid.GetHtml( tableStyle: "webgrid", headerStyle: "webgrid-header", footerStyle: "webgrid-footer", …
foxtrotZulu
  • 1,109
  • 11
  • 24
0
votes
1 answer

How to put empty strings at the end when sorting

When sorting a column on my WebGrid from A to Z, the empty strings always come up first, so I have : "" "" "A" "B" (Without the quotes of course). I want them to come up last, is there a simple way to do this ?
deonclem
  • 860
  • 10
  • 25
0
votes
2 answers

WebGrid footer get styling for the current page

Im trying to get a WebGrid view to work using razor, and so far i have managed to style mostly everything apart from the paging icons of the footer. I've searched a lot of places to see how i can modify the CURRENT SELECTED PAGE (text) of the footer…
Hanho
  • 229
  • 1
  • 4
  • 16
0
votes
1 answer

WebGrid constructor parameters are wrong

I cannot understand why do i have an error on my constructor line. I try to create a class that containes a WebGrid and a Custom set of filters here is the code public class FilterableWebGrid : System.Web.Helpers.WebGrid { public…
Mortalus
  • 10,574
  • 11
  • 67
  • 117
0
votes
1 answer

Named arguments specifications must appear after all fixed arguments in WebGrid MVC3

I have to display if the Grid column value is "true" then "Yes" else "No". Tried in WebGrid but throwing me error in the GridColumn in View. //Code: grid.Column("SelectedStatus", header: "Selected Status", Model.SelectedStatus==true ? …
A Coder
  • 3,039
  • 7
  • 58
  • 129
0
votes
2 answers

Column width on webgrid lost after postback

I have a very simple webgrid with 3 columns: View columns: grid.Columns( grid.Column("Applicant Name", format: (item) => @Html.ActionLink((string)item.Name, "EditApplicant", "Applicant", new { id = item.ApplicantId }, …
Alicia
  • 1,152
  • 1
  • 23
  • 41
0
votes
1 answer

How to pass 2 lists to 1 view

I want to show recent and incoming appointments in my view(one page).Here is my controller where can i add the second list and how can i pass it to same view?I know I cant return two list but there must be way for it? public ActionResult Index() …
user1953051
  • 321
  • 2
  • 7
  • 21
0
votes
1 answer

Webgrid in mvc4 reload with ajax

I have a Web Grid with paging and sorting enabled. Right now all are working fine. I tried to add a search text box and a link "GO" just above the grid. My aim is to filter the grid according to the text in that Textbox. What is the best method i…
0
votes
1 answer

Different styles for text and elements inside another element

I'm trying to style the pager of a WebGrid element in Asp.Net MVC. The pager looks something like this: <<  1   2  3 
Andrei V
  • 7,306
  • 6
  • 44
  • 64
0
votes
2 answers

Aligning WebGrid headers ASP.net MVC

I need to set the text alignment for individual column headers in the ASP.net WebGrid. Found this, MVC3 WebGrid header alignment and various other people asking the same question, but no real satisfactory answer. Not really up for replacing it with…
kpollock
  • 3,899
  • 9
  • 42
  • 61
0
votes
1 answer

concatenated columns as action link

I am concatenating three columns of my model and displaying them as one as action link which calls a method of controller.I write some code which is giving errors that item does not exist in current context and The best overloaded method match for…
Wasfa
  • 266
  • 5
  • 29
0
votes
3 answers

MVC WebGrid - How to call a method on WebGridRow item / model?

When using WebGrids, I find that I can access properties on the model bound to the WebGrid, but I can't access methods on the Model itself. As an example, this works: // Accessing a property of item works reportGrid.Column("", header: "First Name",…
gooberverse
  • 265
  • 3
  • 6