This is a migrated thread and some comments may be shown as answers.

Column Width

1 Answer 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ronaldo
Top achievements
Rank 1
Ronaldo asked on 17 Jul 2012, 03:03 PM
I need to set the width of all columns to 200px. So far I have not found a solution. I'll be very happy if you give me a solution. Here's the code below.

gridString.Append(Html.Telerik().Grid<ProducaoViewModel>().Name("Grid").BindTo(Model)
             .EnableCustomBinding(true)
             .Columns(columns =>
             {
                 columns.LoadSettings(config.listColumnsSettings);
 
                 if (!string.IsNullOrEmpty(config.urlDeletar))
                 {
                     columns.Template(c =>
                                      Html.Action("RenderIconExcluir", new
                                      {
                                          @href =
                                      config.urlDeletar +
                                      c.getValueByPropertyName(
                                          config.nomeDataKey)
                                      }).ToHtmlString()
                         ).Title("").HeaderHtmlAttributes(new { @width = "3%" });
                 }
                 else
                 {
                     columns.Template(c =>
                                      Html.Action("RenderNothing").ToHtmlString()
                         ).Title("").HeaderHtmlAttributes(new { @width = "3%" });
                 }
             })
             .Pageable(a => a.Total(config.totalRows).PageSize(config.pageSize))
             .Sortable(sorting => sorting.SortMode(GridSortMode.SingleColumn))
             .TableHtmlAttributes(new
             {
                 @class = "CssClass",
                 @border = "1",
                 @align = "left",
                 @cellpadding = "2",
                 @cellspacing = "0"
             })
);






1 Answer, 1 is accepted

Sort by
0
Pedro
Top achievements
Rank 2
answered on 17 Jul 2012, 07:04 PM
Just use the .Width() method.

for example:

columns.LoadSettings(config.listColumnsSettings).Width(200);

Pedro
Tags
Grid
Asked by
Ronaldo
Top achievements
Rank 1
Answers by
Pedro
Top achievements
Rank 2
Share this question
or