Using the Multicolumn Header example at: http://samples.infragistics.com/2008.2/webfeaturebrowser/default.htm, I've add additional columns to my application's webgrid.
What I would really like to do is add a control, similar to the way you would add a control to a UltraWebGrid.TemplatedColumn, to the ColumnTemplate object I'm adding to the grid using:
(after pushing the grid's bound header down one ".OriginY=1")
int ptsSpan = e.Layout.Bands[0].Columns.Count - 1;// Zero Offset ColumnHeader HeadingText = new ColumnHeader(); HeadingText.Caption = GridHeader; HeadingText.RowLayoutColumnInfo.OriginY = 0; HeadingText.RowLayoutColumnInfo.OriginX = 0; HeadingText.RowLayoutColumnInfo.SpanX = ptsSpan; e.Layout.Bands[0].HeaderLayout.Add(HeadingText);
during the grid's InitializeLayout event.
Anyone know of a way to insert a control in a ColumnHeader object?
Thanks.
Hello,
I just went through the source for ColumnHeader, but unfortunately also could not find any way to template it via templates or adding controls directly to the Controls collection - neither of these is supported. Maybe you can try adding HTML tags directly in the Caption and see how it goes? e.g. HeaderText.Caption = '<span class='someclass'>Some Caption</span>" to format the appearance?
Thanks for the reply. I was hoping to be able to drop a .Net control in the header. Maybe I'll use some client-side javascript to move it so that it looks like it's in the header.
With regards to the column header's style, another option that I used is:
GridItemStyle ColumnStyle = YourColumnHeaderObject.Style;
It will give you access to the object's '.CssClass' property to set it to 'someclass'.
I had some difficulty getting the browsers to render my html code correctly.
Setting the .CssClass didn't confuse the browsers on how I wanted the html elements to render.