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.
Moving a control on the client sounds like a very good idea. Maybe you can use the built-in setLocation method that ASP.NET AJAX provides (you will need a ScriptManager instance on the page). Positioing in browsers is a tricky topic and setLocation will spare you a lot of nasty coding:
http://asp.net/AJAX/Documentation/Live/ClientReference/Sys.UI/DomElementClass/SysUIDomElementSetLocationMethod.aspx
You can obtain an instance to the cell in the header on the client using our Client Side Object Model documented here:
http://help.infragistics.com/NetAdvantage/NET/2008.2/CLR2.0/
(the CSOM link is at the bottom of the left navigation)
and then use the built in ASP.NET getLocation method to gets its coords
http://asp.net/AJAX/Documentation/Live/ClientReference/Sys.UI/DomElementClass/SysUIDomElementGetLocationMethod.aspx
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.
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?