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

HorizontalAlign="Center" Not Applied

17 Answers 221 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shaun Peet
Top achievements
Rank 2
Shaun Peet asked on 11 Dec 2007, 04:14 PM
It appears that any styling definitions that are not defined by the skin itself are completely ignored - including alignment, width, font styles, etc.

When will this be included?

17 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 11 Dec 2007, 05:13 PM
Hi Shaun,

I'm afraid we could not reproduce the problem. Can you post an example which replicates that?

Kind regards,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shaun Peet
Top achievements
Rank 2
answered on 12 Dec 2007, 06:32 AM
Well I've defined a few things in the .skin file.  I can successfully change the Skin of the grid, but it's forcing everything to text-align left even though I've specified HorizontalAlign="Center" for the items, headers, etc.

I haven't tried setting within the individual grids yet - there are many - hoping that I can keep using the .skin file to control the "default" settings.

Also...is the Excel skin planned for the new grid?
0
Konstantin Petkov
Telerik team
answered on 12 Dec 2007, 07:15 AM
Hi Shaun,

All the Prometheus RadControls include now 11 embedded skins, namely:

Black
Default
Default2006
Inox
Mac
Office2007
Outlook
Telerik
Vista
Web20
WebBlue

The other skins will be available for download from the site and can be used as custom skins. You can find an example here.

Regards,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shaun Peet
Top achievements
Rank 2
answered on 12 Dec 2007, 07:47 AM
Thanks for the info.  Two things:

The skins download page does not mention prometheus.

Since the excel skin isn't included in the grid I'm using the old excel skin and therein lies the problem as the horizontalalign="center" has no effect.  Is there a new excel skin (not embedded) that I should be using instead?
0
Konstantin Petkov
Telerik team
answered on 12 Dec 2007, 11:33 AM
Hello Shaun,

I just tried the old Excel skin over the Prometheus Grid and changed a single CSS setting only as follows:

.GridRow_Excel td,  
.GridAltRow_Excel td, 
.GridEditRow_Excel td 
    border-bottom: 1px solid #c0c0c0; 
    border-right: 1px solid #c0c0c0; 
    text-align: center; /* to center align data */ 

This center-aligns the data so that it matches the header alignment.
You will find the test sample attached to my response.

Kind regards,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shaun Peet
Top achievements
Rank 2
answered on 13 Dec 2007, 05:05 AM
That works...however it would be better if the properies would work rather than changing the skin.  Particularly if using the embedded skins; since that eliminates the options.
0
Konstantin Petkov
Telerik team
answered on 13 Dec 2007, 09:34 AM
Hi Shaun,

The skin .css overrides markup settings and this is by design. For those who need to modify the existing skins, we have explained the classes in details in Grid documentation here.

I'm glad the solution fixed the problem on your side. Should you need further assistance, do not hesitate to contact us again.

Greetings,
Author nickname
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shaun Peet
Top achievements
Rank 2
answered on 13 Dec 2007, 05:00 PM
This looks like the prometheus editor for the forums!  Finally!

...anyways there is a flaws in what you are saying:
1) You shouldn't have to change a .css skin file in order to get the alignment you want.  If you want to apply it globally you should be able to set it in a .skin file or in the properties of the grid itself (why are those properties there if they are ignored?)
2) Let's say you want to have all you columns centered, except for one.  You should be able to set the alignment of that column using the property and not have to come up with a new .css rule for that one column and then try to figure out how to get all the cells in that column to use that rule instead of the normal one.

It just looks like when the grid is rendered to the page that the individual <td> tags have no class definitions at all; which means that they always will use the .css rule defined in the skin for a table cell.  The <tr> tags do have class definitions, as well as every other parent above it.  So where are the deinitions applied to columns; ie. to each individual <td> in that column?
0
Konstantin Petkov
Telerik team
answered on 14 Dec 2007, 08:26 AM
Hello Shaun,

The properties can be used when the Grid has no Skin set. If you set embedded skin but want to change its outlook, you have to modify the skin accordingly either from the .css file or overriding the respective class in the markup if you prefer.

Kind regards,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shaun Peet
Top achievements
Rank 2
answered on 17 Dec 2007, 05:54 PM
"The properties can be used when the Grid has no Skin set. If you set embedded skin but want to change its outlook, you have to modify the skin accordingly either from the .css file or overriding the respective class in the markup if you prefer"

I'm just trying to help you guys out with this one.  You're making what seems to the developer a very simple task quite difficult to accomplish.

That first statement is completely rediculous.  Essentially I can control the alignment of every column using properties as desired so long as I'm ok with the grid having no styling whatsoever?  Huh?

The second statement is equally strange.  To accomplish that, I'd have to create my grid, apply the embedded skin, run the project, view the source to figure out what the css class names are, and then add the css override rules to the top of my page.  I've used your controls for years - I love using them, and I have enough knowledge to pull that off - and even I think that's a very crappy option that will be out of the capabilities of alot of people.

If you are going to have a public property called HorizontalAlign then it should do precisely what its name implies - regardless of the skin that is currently applied.  I know you're trying to reduce the HTML markup being rendered, but you should still be able to fine-detail the appearance of each cell in the grid if you wanted to by setting properties in design time.  How the grid interprets these properties and renders them on the page is something that you (telerik) need to figure out.

My suggestion would be that instead of this:
<div class=""><table class=""><tr class=""><td></td></tr></table></div>

You have this:
<div class=""><table class=""><tr class=""><td><div style=""></div></td></tr></table>

So every cell has a div wrapper around its content which is set by the skin's css by default, and can override those definitions by setting inline style definitions that come from the grid and/or column properties.
0
Konstantin Petkov
Telerik team
answered on 18 Dec 2007, 05:27 PM
Hello Shaun,

I completely understand and accept your position on the matter (from user point of view) and we will discuss that internally once again how to improve the control behavior.

The problem with the HorizontalAlign property comes from the fact that the property is inherited from System.Web.UI.WebControls.TableItemStyle as you can see through Reflector. It renders the elements which should be changed in order to override the .css settings. So we have to re-implement the property for all the Grid classes which use that and do the same for all the inherited properties. This does not sound like an acceptable solution to me personally.

Other than that, thank you for sharing your feedback in the forums! The discussion would be of help for the community.

Regards,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Guido Tapia
Top achievements
Rank 1
answered on 18 Dec 2007, 10:12 PM
I think my issue may relate to this also.

I define css classes in the skin, eg: ItemStyle CssClass="GridItemStyle".

This is not being added to the class of the Item (doing a view source shows this).

This worked in RadControls RadGrid.  This is easily resolved by adding
.MasterTable_<Skin> td {} defenition to the css but it would be nice if CssClass still worked so hardcoding skins was not neccessary.

Thanks
0
Konstantin Petkov
Telerik team
answered on 19 Dec 2007, 06:57 AM
Hi Guido,

You can use override the .css in page markup as before. For example look at the demo here to see how the editor .css is changed:

http://www.telerik.com/demos/aspnet/prometheus/Controls/Examples/Integration/GridEditors/DefaultCS.aspx

The CssClass property can be used as well. Perhaps you are missing the "!important" part.

All the best,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Vlad
Telerik team
answered on 21 Dec 2007, 03:16 PM
Hello guys,

The align attribute will be replaced with inline text-align css. The fix will be available with the first service pack which will come in the middle of January 2008.

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shaun Peet
Top achievements
Rank 2
answered on 27 Dec 2007, 05:34 PM
Sounds great!  Some follow-up questions:
 
1) Will the rest of the properties be applied as inline styles, such as Font-Size, Font-Bold, BackColor, etc?
2) Are these applied at the <tr> level or at the <td> level if defined as <ItemStyles />?  If the HorizontalAlign property is set on a column does it overrride the default setting for that row?
3) Are properties going to be used to write inline styles for all of your controls?  I noticed a forum thread in the ComboBox forum about setting the FontSize as well. 
0
Sebastian
Telerik team
answered on 03 Jan 2008, 02:09 PM
Hi Shaun,

Onto your questions:

  1. Indeed all column style settings will be applied as inline styles when set through the corresponding column properties.
  2. The style definitions set through the ItemStyle and AlternatingItemStyle tags will be applied for the tr elements of the table inline as with the columns. The HorizontalAlign property of the column applies for the header element of that column only and will not override the HorizontalAlign property for the row cell.

    See the attached project for further details.
  3. Basically, all Prometheus controls provide the option to style their items additionally when using one of the predefined skins. Here is a relevant article from the RadComboBox online help:

    http://www.telerik.com/help/radcontrols/prometheus/?combo_itemstyle.html
Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Shaun Peet
Top achievements
Rank 2
Answers by
Konstantin Petkov
Telerik team
Shaun Peet
Top achievements
Rank 2
Guido Tapia
Top achievements
Rank 1
Andrea
Top achievements
Rank 2
Iron
Vlad
Telerik team
Sebastian
Telerik team
Share this question
or