How to increase cell width of MVC Grid?

I am developing ASP.net MVC application.

I have used MVC Grid - Html Grid in it. I want to increase the width of the columns but I cant. I dont want to change the Grid CSS.

I have mentioned width property twice but none of it works...

Here is my code.

 @model IEnumerable<StockWatchScreen.Controllers.Customer>
@using GridMvc.Html
@using System.Web.UI.WebControls;

@{
    ViewBag.Title = "Index";
}

<!DOCTYPE html>

<html>

<body>
    <div class="listheading span9" style="font-size:22px;margin-bottom:30px;margin-left:0.10px">Customer</div>
    <hr />
    <div style="width:500px;">
        @Html.Grid(Model).Columns(columns => 
                    {
                        columns.Add(c => c.Code).Titled("Code");
                        columns.Add(c => c.Name).Titled("Name").SetWidth(500);
                        columns.Add(c => c.Address).Titled("Address");
                        columns.Add(c => c.OfficePhone).Titled("OfficePhone");
                        columns.Add(c => c.Email).Titled("Email");
                        columns.Add(c => c.FaxNo).Titled("FaxNo");
                        columns.Add(c => c.City).Titled("City");
                       }).WithPaging(4).Sortable(true).Filterable(true)  


    </div>
</body>
</html>

Answers


Can you try changing

columns.Add(c => c.Name).Titled("Name").SetWidth(500);

to

columns.Add(c => c.Name).Titled("Name").SetWidth("70%");

or

columns.Add(c => c.Name).Titled("Name").SetWidth("100px");

Need Your Help

How do I support different Screen sizes in Windows Mobile?

c# windows-mobile compact-framework marketplace

I´m writing a Compact Framework Application for Windows Mobile 6.5. The Application will be sold in the Windowsphone Marketplace. To do so, I have to support the various Screen sizes and resolution...

JVM Problematic frame - EXCEPTION_ACCESS_VIOLATION Error

java grails jvm fatal-error jvm-crash

I am getting the following error while running Grails application: