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

[Solved] Increasing the height of the header row

3 Answers 189 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.
william
Top achievements
Rank 1
william asked on 30 Aug 2011, 10:31 AM
Hi All,

I am using the Telerik Grid control for MVC. How do I increase the height of the header column?

One of my columns has a long text value but the data is small, so I have split the header using <br> but the header row doesn't increase in height to display the full text. Here's my code to help. I thought I might be able to put something in my RowAction event, but I dont know what to test against.
@(Html.Telerik().Grid<GRID.ViewModels.EngineeringRiskViewModel>()
      .Name("risksGrid")     
      .Sortable()
      .ToolBar(toolbar => toolbar.Template(
        @<text>
            @Html.ActionLink("Add Risk", "Create", "EngineeringRisk", new { policyZoneID = Model.PolicyZoneID, sectionID = Model.SectionID }, new { @class = "addLink" })
        </text>))
       .DataKeys(keys => keys.Add(r => r.RiskID))
        .DataBinding(dataBinding =>
                             dataBinding.Ajax().Select("_RisksIndex", "EngineeringSection", new { policyZoneID = Model.PolicyZoneID, sectionID = Model.SectionID })
                         )
                      .Columns(columns =>
                      {
                          columns.Bound(r => r.RiskID)
                                .ClientTemplate(
                                    @Html.ActionLink(" ", "Edit", "EngineeringRisk", new { policyZoneID = Model.PolicyZoneID, sectionID = Model.SectionID, riskID = "<#= RiskID #>" }, new { @class = "editLink" }).ToHtmlString() +
                                    @Html.ActionLink(" ", "Delete", "EngineeringRisk", new { policyZoneID = Model.PolicyZoneID, sectionID = Model.SectionID, riskID = "<#= RiskID #>" }, new { @class = "deleteLink" }).ToHtmlString()
                              ).Width(20).Title("Commands").Sortable(false).Filterable(false);
                          columns.Bound(r => r.CategoryID).Width(230);
                          columns.Bound(r => r.Description).Width(100);
                          columns.Bound(r => r.RiskID).Hidden();
                          columns.Bound(r => r.CreatedBy).Hidden();
                          columns.Bound(r => r.CreatedOn).Hidden();
                          columns.Bound(r => r.SectionID).Hidden();
                          columns.Bound(r => r.TypesSize).Width(50);
                          columns.Bound(r => r.SumInsured)
                                 .Width(30)
                                 .Aggregate(aggregates => aggregates.Sum())
                                 .ClientFooterTemplate("Total: <#= typeof Sum != 'undefined' ? $.telerik.formatString('{0:0}', Sum) : 0 #>");
                          columns.Bound(r => r.BDN).Width(1);
                          columns.Bound(r => r.EXP).Width(1);
                          columns.Bound(r => r.ADL).Width(1);
                          columns.Bound(r => r.MDL).Width(1);
                          columns.Bound(r => r.FRAG).Width(1);
                          columns.Bound(r => r.OSP).Width(1);
                          columns.Bound(r => r.SUD).Width(1);
                          columns.Bound(r => r.LGE).Width(1);
                          columns.Bound(r => r.Quantity).Width(5);
                          columns.Bound(r => r.InspectionPremium)
                                 .Width(100)
                                 .Aggregate(aggregates => aggregates.Sum())
                                 .ClientFooterTemplate("Total: <#= typeof Sum != 'undefined' ? $.telerik.formatString('{0:0}', Sum) : 0 #>");
                          columns.Bound(r => r.InsurancePremium)
                                 .Width(100)
                                 .Aggregate(aggregates => aggregates.Sum())
                                 .ClientFooterTemplate("Total: <#= typeof Sum != 'undefined' ? $.telerik.formatString('{0:0}', Sum) : 0 #>");
                      })
                        .RowAction(row =>
                        {
                            if (row.IsAlternate) { row.HtmlAttributes["style"] = "background:aliceblue;"; }
                        })
                        .ClientEvents(events => events.OnDataBound("risks_onDataBound"))
    )

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 30 Aug 2011, 11:19 AM
Hello William,

Please refer to:

http://www.telerik.com/community/forums/aspnet-mvc/general/how-to-wrap-column-text-of-grid-asp-net-mvc2.aspx

All the best,
Dimo
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
william
Top achievements
Rank 1
answered on 30 Aug 2011, 11:41 AM
This looks as though it would then apply whereever the grid is used. I only want the height changed on 1 form
0
Accepted
Dimo
Telerik team
answered on 30 Aug 2011, 01:34 PM
Well, in this case you should assign a custom CSS class for the Grid with HtmlAttributes and then use this CSS class instead of  t-grid.


Regards,
Dimo
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Grid
Asked by
william
Top achievements
Rank 1
Answers by
Dimo
Telerik team
william
Top achievements
Rank 1
Share this question
or