Gridview column summary font

9 posts, 0 answers
  1. Munish Sharma
    Munish Sharma avatar
    13 posts
    Member since:
    Jan 2010

    Posted 15 Feb 2010 Link to this post

    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,
  2. Roar Olsen
    Roar  Olsen avatar
    1 posts
    Member since:
    May 2009

    Posted 16 Feb 2010 Link to this post

    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;
                }
            }
  3. Nick
    Admin
    Nick avatar
    767 posts

    Posted 16 Feb 2010 Link to this post

    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.
  4. Munish Sharma
    Munish Sharma avatar
    13 posts
    Member since:
    Jan 2010

    Posted 16 Feb 2010 Link to this post

    Thanks a lot. Worked for me.
  5. Muthu
    Muthu avatar
    8 posts
    Member since:
    Oct 2012

    Posted 09 Jul 2013 Link to this post

    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?
  6. Actrol Parts
    Actrol Parts avatar
    1 posts
    Member since:
    Aug 2012

    Posted 09 Jul 2013 Link to this post

     Refer Munish's comments
  7. Munish Sharma
    Munish Sharma avatar
    13 posts
    Member since:
    Jan 2010

    Posted 09 Jul 2013 Link to this post

    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
  8. Muthu
    Muthu avatar
    8 posts
    Member since:
    Oct 2012

    Posted 10 Jul 2013 Link to this post

    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"



  9. Dimitar
    Admin
    Dimitar avatar
    2907 posts

    Posted 11 Jul 2013 Link to this post

    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 >>
Back to Top