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....
Here is the output of the groups during debugging:
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}