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

Grouping not being displayed on Header for Sub Groups

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 2
Bill asked on 24 Jan 2013, 04:14 PM
I'm having an issue where the grid is not displaying the Ship sub total (see attachment).

How can I get the Ship Total to display the total for the Ship instead of the "{0:C}" literal?

How can I also get rid of the SORT bar (see attachement).
I don't have any code behind to handle this and I don't need to.

Here is some pertinent code that I have the way the grid is set up....
<telerik:RadGrid ID="RadGrid1" runat="server"
                        PageSize="20" AllowSorting="True" AllowPaging="True" ShowGroupPanel="True"
                        OnColumnCreated="RadGrid1_ColumnCreated">
                        <PagerStyle Mode="NumericPages"></PagerStyle>
                        <MasterTableView Width="100%">
                        </MasterTableView>
                        <ClientSettings>
                            <Resizing AllowColumnResize="True"></Resizing>
                        </ClientSettings>
                    </telerik:RadGrid>

protected void Button1_Click(object sender, EventArgs e)
{
    string groupBY = "CruiseLine [CruiseLine], Sum(Sales) GroupTotal [CruiseLine Total] Group By CruiseLine";
    group(groupBY);
}
 
protected void Button2_Click(object sender, EventArgs e)
{
    string groupBY = "Ship [Ship], Sum(Sales) GroupTotal [Ship Total] Group By Ship";
    group(groupBY);
}
 
protected void Button3_Click(object sender, EventArgs e)
{
    string groupBY = "Date [Date], Sum(Sales) GroupTotal [Date Total] Group By Date";
    group(groupBY);
}

protected void group(string groupBY)
    {
        try
        {
            GridGroupByExpression expression1 = GridGroupByExpression.Parse(groupBY);
            this.CustomizeExpression(expression1);
            this.RadGrid1.MasterTableView.GroupByExpressions.Add(expression1);
        }
        catch (Exception ex)
        {
            lblError.Text = string.Format("<span style='color:red'>Cannot add group by expression: {0}</span>", ex.Message);
            lblError.Visible = true;
        }
        finally
        {
            BindData();
        }
    }

protected void BindData()
    {
        Hashtable htParams = new Hashtable();
        htParams.Add("@CruiseLine", ViewState["prmCruiseLine"]);
        htParams.Add("@Ship", ViewState["prmShip"]);
        htParams.Add("@FromDate", FromDate.SelectedDate.Value.ToShortDateString());
        htParams.Add("@ToDate", ToDate.SelectedDate.Value.ToShortDateString());
 
        // Call SPROC to populate grid
        DataUtiliities data = new DataUtiliities("PrepaidConnectionString");
        DataSet dsRpt = data.ExecuteDataSet("SelectProductInfoByShipAndDate2", htParams);
 
        // Bind the Grid
        RadGrid1.DataSource = dsRpt.Tables[0].DefaultView;
        RadGrid1.DataBind();
    }

Here is the output of the groups during debugging:
groupBY = "CruiseLine [CruiseLine], Sum(Sales) GroupTotal [CruiseLine Total] Group By CruiseLine"
expression1 = {CruiseLine , sum(Sales) GroupTotal Group By CruiseLine}
 
groupBY = "Ship [Ship], Sum(Sales) GroupTotal [Ship Total] Group By Ship"
expression1 = {Ship , sum(Sales) GroupTotal Group By Ship}

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 30 Jan 2013, 02:51 PM
Hi William,

We have reports for similar issue in the past however it appeared to be rather difficult to reproduce on our end as it depends on the specific data added in the RadGrid. I would suggest you to open a regular support ticket and send us a sample runnable application which demonstrates the problem.
Meanwhile you could disable the Linq Grouping and verify if the issue still appears.

Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Bill
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Share this question
or