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

Summary row in rad grid

1 Answer 90 Views
GridView
This is a migrated thread and some comments may be shown as answers.
vikas
Top achievements
Rank 1
vikas asked on 17 Oct 2012, 01:17 PM

Hi Team,
I am binding grid to the out put of a stored procedure on page load.

I see some dummy blank rows getting added. Can you please let know on how i can remove this.
[ I have checked my stored procedure and it is not returning any blank row]

***********************************
I am adding the summary row like this. The below code is in page load.

GridViewSummaryItem Additional_Pipeline_Needed = new GridViewSummaryItem("Additional_Pipeline_Needed", "{0}", GridAggregateFunction.Sum);
              GridViewSummaryItem Next_Year_Backlog = new GridViewSummaryItem("Next_Year_Backlog", "{0}", GridAggregateFunction.Sum);
              GridViewSummaryItem Next_Year_Weighted_Pipeline = new GridViewSummaryItem("Next_Year_Weighted_Pipeline", "{0}", GridAggregateFunction.Sum);
 GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem(new GridViewSummaryItem[] { 
                  ,Additional_Pipeline_Needed,Next_Year_Backlog,Next_Year_Weighted_Pipeline});
              this.rgvSummaryReport.SummaryRowsBottom.Add(summaryRowItem);

I have ViewCellFormatting & CellFormatting events which is used to add $ symbol and replace - of negative number with ()
Ex: -5 will become ($5)

private void radgrid_ViewCellFormatting_1(object sender, CellFormattingEventArgs e)
        {
           
                GridSummaryCellElement cell = e.CellElement as GridSummaryCellElement;
                if (e.CellElement != null)
                {
                    if (e.CellElement.Text.Contains("$-"))
                    {
                        e.CellElement.Text = e.CellElement.Text.Replace("$", "").Replace("-", "($") + ")";
                        e.CellElement.TextAlignment = ContentAlignment.MiddleRight;
                    }
                }
          }

private void radgrid_CellFormatting(object sender, CellFormattingEventArgs e)
        {
                GridSummaryCellElement cell = e.CellElement as GridSummaryCellElement;
                if (e.CellElement != null)
                {
                    if (e.CellElement.Text.Contains("$-"))
                    {
                        e.CellElement.Text = e.CellElement.Text.Replace("$", "").Replace("-", "($") + ")";
                        e.CellElement.TextAlignment = ContentAlignment.MiddleRight;
                    }
                }
        
}


After writing the above code, the -ve sign in a column in the  total row does not show up with () on page load. It still appears as $-5, but on click on any cell, it gets changed to  ($5)
Can you pls help.

Regards,
-Vikas

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 19 Oct 2012, 03:18 PM
Hello Vikas,

Reviewing your code snippets, screenshot and message I think that this is a web application and you use the our AJAX grid control, while you are posting in the WinForms forum. Please, provide us with additional details about your scenario and type of your application. Hence we will be able to assist you further. 

Thank your for your time and cooperation. I am looking forward to your response. 

All the best,
Julian Benkov
the Telerik team
You’ve been asking for it and now it’s time for us to deliver. RadControls for WinForms Q3 2012 release is just around the corner. Sign up for a free webinar to see first all the latest enhancements.
Tags
GridView
Asked by
vikas
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or