This is a migrated thread and some comments may be shown as answers.

[Solved] set background color for 2nd level detail table

11 Answers 551 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Priya
Top achievements
Rank 1
Priya asked on 23 Mar 2009, 11:37 AM
hi,
I have a radgrid with 2 level detail tables.
For the 1st detail table i applied CSS by giving styles in CSS

 

.DetailTable_Default Caption  
{  
 background-color:#b0c4de;  
}  
Caption  
{  
color:#233D3D; text-align:left; font-weight:bold; text-transform:uppercase;background-color:#b0c4de;  
<DetailTables> 
        <telerik:GridTableView Name="TableViewAssociateDoc" CommandItemDisplay="Top" Width="100%" 
        Caption="TERMS AND SC DOCUMENTS" AllowPaging="false" PageSize="1" CssClass="DetailTable_Default"


i have another detail table insideTableViewAssociateDoc.
But i couldnt set a different style for that detail table caption .hw is it possible
plz help me...........
Thanks...

11 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Mar 2009, 11:56 AM
Hello Priya,

You can try out the following code to set the background color of the third level grid caption:
aspx:
<telerik:RadGrid  ID="RadGrid1" DataSourceID="SqlDataSource" runat="server" > 
       <MasterTableView DataSourceID="SqlDataSource"
         <DetailTables >             
           <telerik:GridTableView ShowFooter="true" Caption="SecondLevelGrid" CssClass="Detail1" DataSourceID="SqlDataSource1" Name="Detail1" runat="server" > 
            <DetailTables> 
              <telerik:GridTableView CssClass="Detail2" Caption="ThirdLevelGrid"  DataSourceID="SqlDataSource2" Name="Detail2" runat="server" > 
           

css:
 <style type="text/css"
    .Detail2 Caption   
      {   
       background-color:Red !important;   
      }  
  </style> 

Thanks
Princy.
0
Priya
Top achievements
Rank 1
answered on 23 Mar 2009, 12:04 PM

Thanks alot for ur quick response....

firstly i tried with

.DetailTable_Default Caption  
{  
 background-color:#b0c4de;  
}

But it didnt work even for the 1st detail table
So i gave

.DetailTable_Default Caption  
{  
 background-color:#b0c4de;  
}  
Caption  
{  
color:#233D3D; text-align:left; font-weight:bold; text-transform:uppercase;background-color:#b0c4de;  
} 



Then only that 1st level detail table woked

I tried this for the 2nd level detail table too by giving a differnet CSS class name
ie,
.DetailTable_Sub Caption  
{  
 background-color:#00c4de;  
}  
Caption  
{  
color:#233D3D; text-align:left; font-weight:bold; text-transform:uppercase;background-color:#ff0000;  
} 
 <MasterTableView DataSourceID="SqlDataSource"
         <DetailTables >             
           <telerik:GridTableView ShowFooter="true" Caption="SecondLevelGrid" CssClass="DetailTable_Default" DataSourceID="SqlDataSource1" Name="Detail1" runat="server" > 
            <DetailTables> 
              <telerik:GridTableView CssClass="DetailTable_Sub" Caption="ThirdLevelGrid"  DataSourceID="SqlDataSource2" Name="Detail2" runat="server" > 


but no effect....
0
Accepted
Princy
Top achievements
Rank 2
answered on 24 Mar 2009, 07:41 AM
 Hello Priya,

Did you try adding the !important keyword? If not, try adding it and see if it helps. Since the skin definitions will override any additional css classes for the nested tables, you will have to put a !important keyword to the corresponding inner tables styles in order to take precedence over the owner table rendering.
css:
.DetailTable_Sub Caption   
{   
 background-color:#00c4de !important;   

Thanks
Princy.
0
Priya
Top achievements
Rank 1
answered on 24 Mar 2009, 09:58 AM
hi
i also tried with !important
            }     
.DetailTable_sub Caption  
   
{ background-color:Red !important;}  
but no effect...


0
Priya
Top achievements
Rank 1
answered on 25 Mar 2009, 08:52 AM
Hi,
now its working fine....i thk it may be due to IE version..
Thakns alot...
0
Anil Mandava
Top achievements
Rank 1
answered on 13 Oct 2009, 06:51 PM
I have one detail table and a nested view template and want to change the background color of firstlevel detail table.

my radgrid is using office2007 skin

and I want to be able to change the first level details table background  color
0
Princy
Top achievements
Rank 2
answered on 14 Oct 2009, 07:16 AM
Hi Anil,

I believe, you want to change the appearance of the child table in a hierarchical grid when a predefined skin is applied. If so, then you can refer to the following document which explains on how to get this done:
Different styles in each hierarchy level with skin applied

Hope this helps..
Princy.
0
Anil Mandava
Top achievements
Rank 1
answered on 14 Oct 2009, 01:58 PM
I am not able to change the filter columns background color eventhough I did the same way as you suggested
0
Princy
Top achievements
Rank 2
answered on 15 Oct 2009, 07:31 AM
Hello Anil,

For changing the appearance of the filter row in the child table of a grid, you can follow a slightly different appraoch, which is shown in the example below:
aspx:
<telerik:RadGrid  ID="RadGrid1" DataSourceID="AccessDataSource1" runat="server"  
Skin="Office2007" Width"95%" AutoGenerateColumns="False"
     <PagerStyle Mode="NumericPages"></PagerStyle> 
          <MasterTableView DataSourceID="AccessDataSource1" Width"100%"
               <DetailTables> 
                    <telerik:GridTableView DataSourceID="AccessDataSource2" Width="100%" CssClass="RadGrid_Detail" runat"server"
                    ......... 

js:
 .RadGrid_Detail .rgFilterRow 
   { 
     background: plum !important; 
      
   } 

Thanks
Princy.
0
Philip
Top achievements
Rank 1
answered on 26 Oct 2009, 11:01 PM
Hi,

How about setting the background color for the caption of the detail table to match the backcolor value of the ItemStyle and AlternatingItemStyle of the parent table.

            <DetailTables>
               <telerik:GridTableView Caption="Add entries to the source above" ... />
            </DetailTables>
            <ItemStyle BackColor="LightCyan" Font-Bold="True" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" Wrap="True" />
            <AlternatingItemStyle BackColor="Beige" Font-Bold="True" Font-Italic="False"
                Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
                Wrap="True" />

Can this only be done at run-time? Samples appreciated. Thanks.
0
Dimo
Telerik team
answered on 27 Oct 2009, 09:16 AM
Hello Philip,

For this scenario you need to determine the parent row of the detail table programmatically. Then you can assign suitable CSS classes or properties, according to your preference.

Please review the following example, which should provide guidance how to proceed:

http://www.telerik.com/community/code-library/aspnet-ajax/grid/how-to-obtain-reference-to-radgrid-detailtables-containing-rows-and-cells-and-customize-their-appearance.aspx

Kind regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Priya
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Priya
Top achievements
Rank 1
Anil Mandava
Top achievements
Rank 1
Philip
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or