Hi all,
May i know , why the css setting are not working with ultrawebgrid. In design view i could able to see the colours. While running all become white.
How to make use of CSS in ultrawebgrid?
Thanks !
Hello,
Are you using CellStyle and the CssClass property to set the style?
I think this could be the correct and expected behaviour - the appearance set through styles has higher priority than Css.So I am not sure this classifies as a bug. You are still correct though that it works for some Css styles and not for others
The point is that some default Css styles are applied to the cell (<td> html element) and some of them involve font-size, font-name, etc. This is the default (or chosen) skin of the grid - this is what makes the grid look good by default. However, if you do need to override that, it is still possible using the reserved Css rule !important - this explicitly overrides any defaults you have for the grid.
Here is a sample:
.redCell { color: red; font-size: 20px !important; } </style> <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" DataSourceID="AccessDataSource1" Height="200px" Width="325px"> <Bands> <igtbl:UltraGridBand> <Columns> <igtbl:UltraGridColumn BaseColumnName="FirstName" IsBound="True" Key="FirstName"> <Header Caption="FirstName"> </Header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="LastName" IsBound="True" Key="LastName"> <Header Caption="LastName"> <RowLayoutColumnInfo OriginX="1" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> <CellStyle CssClass="redCell" /> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="EmployeeID" DataType="System.Int32" IsBound="True" Key="EmployeeID"> <Header Caption="EmployeeID"> <RowLayoutColumnInfo OriginX="2" /> </Header> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> </Columns> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> </igtbl:UltraGridBand> </Bands> <DisplayLayout BorderCollapseDefault="Separate" Name="UltraWebGrid1" RowHeightDefault="20px" Version="4.00"> <FrameStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt" Height="200px" Width="325px"> </FrameStyle> <Pager> <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <BorderDetails ColorLeft="White" ColorTop="White" /> </PagerStyle> </Pager> <EditCellStyleDefault BorderStyle="None" BorderWidth="0px"> </EditCellStyleDefault> <HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid"> <BorderDetails ColorLeft="White" ColorTop="White" /> </HeaderStyleDefault> <RowStyleDefault BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt"> <Padding Left="3px" /> <BorderDetails ColorLeft="White" ColorTop="White" /> </RowStyleDefault> <AddNewBox> <BoxStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <BorderDetails ColorLeft="White" ColorTop="White" /> </BoxStyle> </AddNewBox> <ActivationObject BorderColor="" BorderWidth=""> </ActivationObject> </DisplayLayout> </igtbl:UltraWebGrid> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb" SelectCommand="SELECT [FirstName], [LastName], [EmployeeID] FROM [Employees]"> </asp:AccessDataSource>
In this case, the font-size will be applied always for the cell in question even though there is a different default Css.
HTH,