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