I have a main data table and a sub data table. But in the sub data table, even if there is no data, the total number appears.
This is my code in the main table for CustomAggregate . Can the total part of my sub table be handled here?
private void Grid_CustomAggregate(object sender, GridCustomAggregateEventArgs e){
RadGrid grid = PlaceHolder1.FindControl("grid") as RadGrid;
string colName = e.Column.UniqueName;
if (e.Item is GridFooterItem)
{
if (colName == "ProjectID")
{
// decimal counter = 0;
e.Result = "Total hours of timesheet";// counter;
}
if (colName != "ProjectAlias" || colName != "ProjectID")
{
decimal value = ClsTimeSheet.GetTimeSheetDateTotalHour(LbEmplNo.Text, LbPeriodCode.Text, colName);
decimal value2 = ClsTimeSheet.GetTimeSheetCPDateTotalHour(LbEmplNo.Text, LbPeriodCode.Text, colName);
e.Result = (value + value2).ToString();
}
}
}
Please Help. Terry
Hi Terry,
RadGrid will not display numbers randomly. My guess is that number 3 in the footer comes from the logic you have. Unfortunately, the information you provided is insufficient for us to share our feedback. Please share the complete Grid definition you have, and the C# code related to it. You can also show us an example of what the data structure looks like, and what type of values it contains so we can set up a database table with dummy data. Then we will be able to try and replicate the issue locally.
I look forward to receiving the additional information.