MVC3 WebGrid header alignment

WebGrid (Razor)

How can the headers alignment be set?

I need to be able to change the alignment for each column (could be different)

It seems to be a all or nothing deal nor does it seem to take the alignment of the child TD.

-------------Problems Reply------------

There currently is not a way to set a different style for each column header using the WebGrid in MVC 3. You can however use the tableStyle property to set the style for all column headers.

.header { text-align: left; }

@var grid = new WebGrid(Model);

@grid.GetHtml(headerStyle: "header") Views:1 Time:2012-02-08

Related post

  • MVC3 WebGrid Formatting or Styling Column Headers 2011-02-01

    I'm using the new MVC3 WebGrid. So far so good, just having issues styling/formatting the column headers. The best I've got is a workaround that applies the same css class from the first row of the WebGrid to the table header. var headerCells = $("#g

  • How to hide header on MVC3 WebGrid 2011-01-17

    Is there some easy way to hide header for MVC3 WebGrid extension? Something like var grid = new WebGrid(Model, canSort:false, canPage:false, showHeader:false); I can probably set css style for header that will cause header not showing, though I'd rat

  • Server side paging for MVC3 Webgrid 2011-06-21

    I have looked at a number of examples (e.g. and but it seems very manual and convoluted. The reason I would like to use the WebGrid is that the

  • MVC3 Webgrid Paging and Sorting 2011-07-18

    I'm using MVC3 webgrid to display, sort and paginate data. The display is fine, but when I click on a new page or request a sort, it opens the table in a brand new window on it's own? Anybody know why this happens? It is contained within a partial vi

  • Based on Model Column Value(true/False) in MVC3 Webgrid , How can Add a Link as column in diplaying the rows 2011-07-18

    I am using MVC3 Webgrid. I have model which has column of type bool. Based on the Value of this coulumn I need to render a coulmn , with hyper link. If the bool column value is true then I have to render Record, else Edit. Could you kindly give the s

  • Does MVC3 WebGrid support horizontal scrollbars? 2011-10-21

    I have a record set that is quite wide (about 25-30 cols)...does MVC3 WebGrid support horizontal scrollbars (or can I house the grid in a html tag/control)? --------------Solutions------------- Never realised about the WebGrid, so had to play with it

  • ASP .NET MVC3 WebGrid footer 2011-10-26

    I really cannot find any good solution to realize ASP .NET MVC3 WebGrid footer which has some total values... Any clue how to do it? Thank you! --------------Solutions------------- I assume best approach is to calculate total value and pass it in mod

  • Why aren't MVC3 webgrid paging and sorting working? 2011-11-04

    I'm using MVC3 webgrid to display, sort and paginate data. The display is fine, but when I click on a new page or request a sort, nothing is happening. This is the code that I'm using: @if (Model.AdsList != null) { WebGrid adGrid = new WebGrid(Model.

  • MVC3 WebGrid toggling sort direction 2011-11-12

    With an ASP.NET MVC3 WebGrid how can I setup the column sorting such that clicking on the column heading toggles between ascending sort and then descending sort? Thanks! Rob --------------Solutions------------- The underlying problem turned out to be

  • Handling Null Values in MVC3 webgrid 2012-01-05

    Can someone please explain me how to handle null values in mvc3 webgrid? --------------Solutions------------- The question is a little vague but I believe you can use the null coalescing operator ??. This question here shows dealing with a null value

  • Display tooltip on mouseover event in MVC3 WebGrid 2012-02-13

    I have a MVC3 WebGrid in my View.I want to display a tooltip when the mouse hovers over any row, displaying information coming from the server. I have already seen this link: Show a tooltip with more info when mousover a MVC3 Razor WebGrid row My poi

  • How can I format a MVC3 WebGrid date column for local timezone? 2012-03-06

    My datetime values are stored as UTC in the database. I want to display them in the local timezone using the standard MVC3 WebGrid control, but don't have a clue how to do that or where to look for the answer. My current code looks like this: grid.Co

  • ASP.NET MVC3 WebGrid - custom, server-side sorting 2012-04-12

    Is there a way to override default MVC3 WebGrid sorting behavior to call my controller (which will perform server side sorting and return the data) when sort is called? Thanks for any help! --------------Solutions------------- You can pass the server

  • ASP.NET MVC3 WebGrid format: parameter 2011-02-25

    I am trying to use the new WebGrid in ASP.NET MVC3 and one of the columns I want to display set of link icons that performs various actions (Edit, View, Delete)... For this purpose I have a HtmlHelper extensions that basically outputs following HTML:

  • Updating div outside ajaxUpdateContainerId when using MVC3 WebGrid 2011-03-30

    Using ASP.NET MVC3 I have a page with this bit: <div id="grid"> <div>@[email protected] of @ViewBag.TotalHits hits</div> <div style="clear: both;"></div> @{ @grid.GetHtml( mode: WebGridPagerModes.All, disp

  • How do you get to the underlying data in an MVC3 WebGrid using jQuery? 2011-05-31

    I have a simple MVC WebGrid. When a user clicks on a row, I'd like to do something based on the row he clicked. Its pretty simple in jqGrid and even using jquery templates, but I'd like to get it right using the MVC WebGrid. I have the following:

  • How to Navigate to a view spacifying the view name and controller when i click a row in mvc3 webgrid? 2011-06-10

    <div style="text-align:center" class="grid"> @{ var grid = new WebGrid(Model.SearchResults, canPage: true, rowsPerPage: 15); grid.Pager(WebGridPagerModes.NextPrevious); @grid.GetHtml(headerStyle: "webgrid-header", footerStyle: "webgrid-footer",

  • MVC3 WebGrid Custom Text in Column 2011-08-01

    I'm developing a web application using MVC3 in VB.NET. I having difficulty setting a column on the webgrid with the following action links Edit | Details | Delete @*@Html.ActionLink("Edit", "Edit", New With {.id = currentItem.PrimaryKey}) | @Html.Act

  • Mvc3 WebGrid ajaxUpdateContainerId duplicates the container 2011-11-07

    I don't know if it is a bug just at my site, but the WebGrid apparently duplicates the container specified on the ajaxUpdateContainerId. Here's my code: <div id="grid-wrapper" class="grid-wrapper"> @{ var a = new [] { new { Mensagens = 3, Nome

Copyright (C), All Rights Reserved.

processed in 0.092 (s). 11 q(s)