I have a grid that has a cell that contains more than one line of data which expands the height of the row to fit that data... this is good it is what i want it to do... however in the other columns the data is centered vertically... this is not good. I've tried the following and neither option seems to be working... what should i do?
grdNotifications.DisplayLayout.Bands(0).Columns.FromKey("FirstName").CellStyle.VerticalAlign = VerticalAlign.TopgrdNotifications.DisplayLayout.Bands(0).Columns.FromKey("FirstName").CellStyle.CustomRules = "vertical-align:top;"
Great - glad I was able to help a bit and thanks a lot for sharing the solution in public forums. This sounds logical and I want to also send you a link that describes this patters (style inheritance) - since the grid is a complex control consisting of many elements, almost all styles are inherited from other styles. Please check out the following link (the Stlye ihneritance Hierarchy link) for additional details:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/WebGrid_About_WebGrid.html
Thanks again.
thanks very much for your efforts... if anything it in a round about way led be to try something else...
UltraWebGrid1.DisplayLayout.RowStyleDefault.VerticalAlign = VerticalAlign.Top
Hello,
I am trying to reproduce the problem, unfortunately to no avial. Please, take a look at my code - both C# codebehind and ASPX setup, as well as a screenshot of what I am getting - the cell is correctly positioned to top (default is indeed middle). The only suggestion I am having at this point is that you are not executing the the CellStyle setting code from the InitializeLayout event of the grid:
protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("FirstName", typeof(string))); dt.Columns.Add(new DataColumn("LastName", typeof(string))); dt.Rows.Add(new string[ { "adsjfslkjfdslkjflkjfs lkjflkjfskjfdsfsafasfalkjsfs alkjlkjflkjsalk jfsflkjdsadslkjf saflkjdsafaf safjsajflksadjflks", "b" }); dt.Rows.Add(new string[ { "a", "b" }); dt.Rows.Add(new string[ { "a", "b" }); UltraWebGrid1.DataSource = dt; UltraWebGrid1.DataBind(); } protected void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e) { UltraWebGrid1.Columns.FromKey("LastName").CellStyle.VerticalAlign = VerticalAlign.Top; } <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" oninitializelayout="UltraWebGrid1_InitializeLayout"> <DisplayLayout AllowColSizingDefault="Free" AllowColumnMovingDefault="OnServer" UseFixedHeaders="true" AllowDeleteDefault="Yes" AllowSortingDefault="OnClient" AllowUpdateDefault="Yes" BorderCollapseDefault="Separate" HeaderClickActionDefault="SortMulti" Name="UltraWebGrid1" RowHeightDefault="100%" RowSelectorsDefault="No" SelectTypeRowDefault="Extended" StationaryMargins="Header" StationaryMarginsOutlookGroupBy="True" TableLayout="Fixed" Version="4.00" ViewType="OutlookGroupBy"> <RowStyleDefault Wrap="true"></RowStyleDefault> <FrameStyle BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid" BorderWidth="1px" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt" Height="200px" Width="325px"> </FrameStyle> <Pager MinimumPagesForDisplay="2"> <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" /> </PagerStyle> </Pager> <EditCellStyleDefault BorderStyle="None" BorderWidth="0px"> </EditCellStyleDefault> <FooterStyleDefault BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" /> </FooterStyleDefault> <HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid" HorizontalAlign="Left"> <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" /> </HeaderStyleDefault> <RowStyleDefault BackColor="Window" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt"> <Padding Left="3px" /> <BorderDetails ColorLeft="Window" ColorTop="Window" /> </RowStyleDefault> <GroupByRowStyleDefault BackColor="Control" BorderColor="Window"> </GroupByRowStyleDefault> <GroupByBox> <BoxStyle BackColor="ActiveBorder" BorderColor="Window"> </BoxStyle> </GroupByBox> <AddNewBox Hidden="False"> <BoxStyle BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid" BorderWidth="1px"> <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" /> </BoxStyle> </AddNewBox> <ActivationObject BorderColor="" BorderWidth=""> </ActivationObject> <FilterOptionsDefault> <FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="11px" Height="300px" Width="200px"> <Padding Left="2px" /> </FilterDropDownStyle> <FilterHighlightRowStyle BackColor="#151C55" ForeColor="White"> </FilterHighlightRowStyle> <FilterOperandDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="11px"> <Padding Left="2px" /> </FilterOperandDropDownStyle> </FilterOptionsDefault> </DisplayLayout> </igtbl:UltraWebGrid>
just in case its relevant i've used this code to increase the row height
grdNotifications.DisplayLayout.RowHeightDefault = Unit.Percentage(100)