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

CAN'T control GRID items columns WIDTH with CSS

3 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rafael Avila
Top achievements
Rank 1
Rafael Avila asked on 26 Aug 2008, 03:55 PM
My scenario:

I want control the width of each grid item and header of a RadGrid.

RadGrid properties:
  • TableLayout="Fixed" 
  • UseStaticHeaders="True"
  • AllowScroll="True"
I set a CssClass to each grid item and to each grid header. I can control the width of headers, but got no effect with grid items.

Notes:
  • When I set UseStaticHeaders ="False" it works.
  • I can control the grid item height of both item and header.
Is there a solution for this scenario?

3 Answers, 1 is accepted

Sort by
0
Rafael Avila
Top achievements
Rank 1
answered on 26 Aug 2008, 03:59 PM
Additional note:
  • I've also tried set the width directly into the grid collumn property, but doesn't work:
       <ItemStyle Width="24px" />
0
Rafael Avila
Top achievements
Rank 1
answered on 26 Aug 2008, 04:20 PM
Strangely.. I got the desired width of the grid item setting the grid header width directly into the grid column properties.

<ItemStyle CssClass="gridItemID" />
<HeaderStyle CssClass="gridHeaderID"  Width="24px"/>

I say it is strange because this header already was set to width 24px via CSS:

.gridHeaderID, .gridItemID
{
    width: 24px !important;
}

so.. if you try:

<ItemStyle CssClass="gridItemID" Width="24px" />
<HeaderStyle CssClass="gridHeaderID"  />

The header wiill have width="24px" because it is set on CSS. But the Item will remain in it's default width...(adjusting to the grid )....

although I got the desired behavior, I would like to know why it works this way? and if I could have it working only with CSS (without setting ItemStyle and HeaderStyle width..)


0
Accepted
Sebastian
Telerik team
answered on 27 Aug 2008, 08:43 AM
Hello Rafael,

The width of the data row cells is controlled by the header cell width because both are synchronized in order to ensure they will be aligned as expected. The rest of the ItemStyle properties are set on individual basis, however the width in particular is "connected" to the header cell dimension. This is why you observed the behavior you described.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Rafael Avila
Top achievements
Rank 1
Answers by
Rafael Avila
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or