Hi All,
In my grid, I have total two rows in Header section. I need to give two different color for these two rows. Can you let me know how to set different row background color for the rows present in Header section?
Thanks in advance,
-Suresh
Hello,
You can use the property BackColor of column header. Please take a look at the code below:
protected void Page_Load(object sender, EventArgs e) { UltraWebGrid1.Columns[0].Header.Style.BackColor = Color.Red; }
Hope this helps.
Hi Ivan,
Thanks for the response.
I tried the code and it is changing the color of the header row column which is generated automatically using databind method. Apart from this row, I created a new row on the fly using Infragistics.WebUI.UltraWebGrid.ColumnHeader and added it to Bands(0).HeaderLayout. It is not changing the color of this dynamically added row. Also I gave the Style.BackColor property for this newly created ColumnHeader. But it is not working. Please help me .
Could you please send a little bit more information about the grid declaration. ASPX declaration, code-behind or sample project – anything that can get us started is welcome.
Thanks.
Hello,You can use the two way to change header color of new column in InitializeLayout event.Please take a look at the code below: void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e) { //First way //add new column UltraWebGrid1.Columns.Add("NewCol", "New Col"); //Change header color of new column UltraWebGrid1.Columns[11].Header.Style.BackColor = Color.Red; //Second way //change header color of other column with HeaderLayout UltraWebGrid1.Bands[0].HeaderLayout[10].Style.BackColor = Color.Red; }Also you can take a look picture:Hope this helps.
Did you get a chance to see the code? Please help me.
Thank you.
Please find attached the aspx and codebehind file. To avoid confusion I deleted the other code from code behind which is not related to grid .
I am adding the new columns to header in the uwgTime_InitializeLayout method.
Please let me know if you need any other information.
Thanks again for you help.