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

[Solved] How to apply a style to all columns?

2 Answers 104 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.
James Strope
Top achievements
Rank 1
James Strope asked on 17 Dec 2010, 01:49 PM
Hello,

I'm using the MVC extensions grid and have figured out how to apply a style to a single column.  However, in my example below, I would like to apply "vertical-align" to all columns, and I assume there is a way to do so without coding it on every column individually.  Can anyone help?

<%= Html.Telerik().Grid(Model)
        .Name("SomeGrid")
        .Columns(columns =>
        {
            columns.Bound(r => r.DateAdded).Width(60);
            columns.Bound(r => r.AddedBy).Width(120).HtmlAttributes(new { style = "vertical-align: top;" });
            columns.Bound(r => r.AccountNumber).Title("Acct #").Width(50).HtmlAttributes(new { style = "background-color: #ecede0;" });
            ...[more columns ommitted]
        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Server().Select("Index", "Home", new { ajax = true });
            dataBinding.Ajax().Select("_Index", "Home").Enabled(true);
        })
        .Pageable()
%>

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 17 Dec 2010, 01:52 PM
Hi James Strope,

 You can use CSS if you want to set global styles:

<style>
#SomeGrid td
{
        vertical-align:top;
}

</style>
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
James Strope
Top achievements
Rank 1
answered on 17 Dec 2010, 02:01 PM
Worked like a charm!  Thank you Atanas.
Tags
Grid
Asked by
James Strope
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
James Strope
Top achievements
Rank 1
Share this question
or