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

Gridview column summary font

8 Answers 355 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Munish Sharma
Top achievements
Rank 1
Munish Sharma asked on 16 Feb 2010, 01:11 AM
I was working on summary totals of the columns in the gridview and successfully got them at the end of the gridview.

The problem I am facing is the font of the summary column is too small to read properly. I have set the theme as breeze and also seen with other themes and without theme also but it's the same as small(doesn't change). Is there any way to increase the font size and to set the font family(Arial), background color/foreground color.

Also if possible, the alignment of the summary totals. 

All my grid data is looking too god but the only think what is lacking behind is the summary column. I have just recently bought the telerik premium controls(Q3 2009 SP 1).

Please see attached file for more understanding and reference.

Anyone help here will be appreciable. Thanks in advance.

Cheers,

8 Answers, 1 is accepted

Sort by
0
Roar Olsen
Top achievements
Rank 1
answered on 16 Feb 2010, 08:35 AM
try the ViewCellFormatting-event

private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
        {
            if (e.CellElement is GridSummaryCellElement)
            {
                e.CellElement.TextAlignment = ContentAlignment.MiddleRight;
                Font summaryFont = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);

                e.CellElement.Font = summaryFont;
            }
        }
0
Nick
Telerik team
answered on 16 Feb 2010, 08:56 AM
Hi,

Thank you Roar, that is the correct way to change the font size and style. I have updated your Telerik points for being active in our community.

All the best,
Nick
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Munish Sharma
Top achievements
Rank 1
answered on 16 Feb 2010, 10:56 PM
Thanks a lot. Worked for me.
0
Muthu
Top achievements
Rank 1
answered on 09 Jul 2013, 12:15 PM
Hi, I want to show sum of a column in another column. ex. i have 2 columns A, B. I will hide column B and show the sum of column B in Column A which is visible. Is it possible? If so, How?
0
Actrol Parts
Top achievements
Rank 1
answered on 09 Jul 2013, 11:51 PM
 Refer Munish's comments
0
Munish Sharma
Top achievements
Rank 1
answered on 09 Jul 2013, 11:54 PM
Hi Muthu,

In ItemDataBound if TypeOf e.Item Is GridFooterItem

If the Aggregate is Set to Sum:
CType(e.Item, GridFooterItem)("A").Text = CType(e.Item, GridFooterItem)("B").Text

If the Aggregate is Set to Custom:
Add the values In ItemDataBound if TypeOf e.Item Is GridItem in a global variable and show GridFooterItem as:

CType(e.Item, GridFooterItem)("A").Text = <Your Private Variable>

Good luck and let me know how did you go.

Munish
0
Muthu
Top achievements
Rank 1
answered on 10 Jul 2013, 06:45 AM
Hi, for windows? There is no item bound for windows.

I have 2 doubts

In Windows,

 > //I want to show sum of a column in another column. ex. i have 2 columns A, B. I will make column B as invisible and show the sum of column B in  Column A which is visible. Is it possible? If so, How? //

> I have 3 columns A, B, C.
Column A(Data type is time) is Start Time, Column B(Data type is time) is End Time and Column C(Data type is decimal(4, 2)) is difference between Start time and End time. I want to display sum of column C in summary footer. How is it possible? If I just give sum in summary it will not give me right answer ex. "4.30 hrs + 4.30 hrs" is "9" but, just summary will give "4.60"



0
Dimitar
Telerik team
answered on 11 Jul 2013, 03:13 PM
Hello Muthu,

Thank you for writing.

Following your scenario I have created a sample project for you. The grid in the project has three columns Start Time, End Time and Duration. The Start Time and End Time columns are DateTime columns and the value in the duration column is Decimal. The value of the Duration column is the difference between the start time and end time. The the duration value is displayed in minutes. The summary row displays the total duration in hours.

Now for the first question, regardless of first and second columns visibility the values of the duration column will remain. For example you can hide the second column like this: 
radGridView1.Columns["EndTime"].IsVisible = false;

As to the second question I use the following expression to calculate the duration in minutes:
radGridView1.Columns["Duration"].Expression = "DATEDIFFMINUTE(StartTime ,EndTime)";

If you want to display the duration in hours use expression like this:
radGridView1.Columns["Duration"].Expression = "DATEDIFFHOUR(StartTime ,EndTime)";

Also you will notice that there is no mistake in summary row when the duration is calculated.

I hope this helps. Should you have any other questions do not hesitate to ask.
 
Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Munish Sharma
Top achievements
Rank 1
Answers by
Roar Olsen
Top achievements
Rank 1
Nick
Telerik team
Munish Sharma
Top achievements
Rank 1
Muthu
Top achievements
Rank 1
Actrol Parts
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or