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

How to change font size in ChildTemplate cells

4 Answers 112 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ljubo Žižić
Top achievements
Rank 1
Ljubo Žižić asked on 02 Jul 2009, 10:36 AM
Hi

I have as GridView with one ChildGridViewTemplate. I need the data in Child template to have lower font size then MasterGrid for example:
- mastergrid rows and header row in font size 10
- childGrid rows and header row in font size 8


Btw I am really enjoying your controls!

Thanks in advance

4 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 03 Jul 2009, 07:40 PM
Hi Ljubo Žižić,

Thank you for contacting us.

This is easy. You should handle the CellFormatting event and check whether the ViewTemplate of the formatted cell has parent. Please consider the sample below:

Font font = new Font("Segoe UI", 8f); 
 
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) 
    if (e.CellElement.ViewTemplate.Parent != null
    { 
        e.CellElement.Font = font; 
    } 

If you have any other questions, please ask the person who purchased the controls in your company to add you as a License Developer to the purchase. More on License Developers and the steps that need to be performed you can find there: www.telerik.com/account/faqs.aspx.
 

Greetings,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ljubo Žižić
Top achievements
Rank 1
answered on 09 Jul 2009, 12:29 PM
Thank you this was very helpful!
It would be great to apply that same font to column headers of childtemplate cells, so whole childgrid is in the same font and font size.

thanks
0
Nikolay
Telerik team
answered on 09 Jul 2009, 03:57 PM
Hi Ljubo Žižić,

If you want to set the font size of the column headers' cells as well, you should use the ViewCellFormatting event:
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)  
{  
    if (e.CellElement.ViewTemplate.Parent != null)  
    {  
        e.CellElement.Font = font;  
    }    

If you have any other questions, please ask the person who purchased the controls in your company to add you as a License Developer to the purchase. More on License Developers and the steps that need to be performed you can find there: www.telerik.com/account/faqs.aspx.

Sincerely yours,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ljubo Žižić
Top achievements
Rank 1
answered on 10 Jul 2009, 07:27 AM
Thanks!
Tags
GridView
Asked by
Ljubo Žižić
Top achievements
Rank 1
Answers by
Jack
Telerik team
Ljubo Žižić
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or