or
| public partial class HistoricData : Form |
| { |
| public IOController TheIO { get; set; } |
| public HistoricData() |
| { |
| InitializeComponent(); |
| } |
| public void FillData(List<ChartHistoric> days, string title) |
| { |
| try |
| { |
| rchrtHistoricData.DataSource = days; |
| rchrtHistoricData.ChartTitle.TextBlock.Text = title; |
| rchrtHistoricData.PlotArea.XAxis.DataLabelsColumn = "Month"; |
| rchrtHistoricData.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = -45; |
| rchrtHistoricData.DataBind(); |
| }catch(Exception ex) |
| { |
| Logging.Log.LogMessageToFile("HistoricData.cs -> FillData(List<ChartHistoric> days): " + ex.Message + ex.StackTrace); |
| } |
| } |
| public void FillTreeView(TreeNode overview) |
| { |
| trvMonths.Nodes.Clear(); |
| trvMonths.Nodes.Add(overview); |
| } |
| public void ClearChart() |
| { |
| rchrtHistoricData.DataSource = new List<ChartHistoric>(); |
| rchrtHistoricData.DataBind(); |
| } |
| private void trvMonths_AfterSelect(object sender, TreeViewEventArgs e) |
| { |
| if(trvMonths.SelectedNode == null) return; |
| //ClearChart(); |
| //get the selected historic data for this month or whole year. |
| //data for the whole year |
| if(trvMonths.SelectedNode.Tag.Equals("1")) |
| { |
| FillData(TheIO.GetDataChartHistoricYear(), "Month view"); |
| } |
| if(trvMonths.SelectedNode.Tag.Equals("2")) |
| { |
| FillData(TheIO.GetDataChartHistoricMonth(trvMonths.SelectedNode.Text), "Week view"); |
| } |
| } |
| } |
| public class ChartHistoric |
| { |
| public ChartHistoric(string _month, int _days) |
| { |
| month = _month; |
| days = _days; |
| } |
| private string month; |
| public string Month |
| { |
| get { return month; } |
| set { month = value; } |
| } |
| private int days; |
| public int Days |
| { |
| get { return days; } |
| set { days = value; } |
| } |
| } |
| +----------+-----------------------------+ |
| | Item | Service | |
| | +-----------------------------+ |
| | | Qty | Description | |
| +----------+-----------------------------+ |
| | Oil | 4 | Quarts | |
| +----------+-----------------------------+ |
GridTableHeaderRowElement
header = (grid.GridElement as GridTableElement).TableBodyElement.Children[0] as GridTableHeaderRowElement;
The Children collection is empty. If I DO add dummy columns to the grid to make the headings work then my data rows have mutiple rows. In the example above, a text box appears in a row above the 4 and Quarts columns representing Service which we don't want.
| private void pendingWorker_RunWorkerCompleted (object sender, RunWorkerCompletedEventArgs e) { |
| try { |
| this.gridView.Rows.Clear(); |
| this.gridView.MasterGridViewTemplate.GroupByExpressions.Clear(); |
| if (documentData != null && documentData.Rows.Count > 0) { |
| int rowCount = 0; |
| foreach (DataRow dr in documentData.Rows) { |
| ModelObject obj = GetModelObject(dr); |
| this.gridView.Rows.AddNew(); |
| PopulateRow(obj, rowCount); |
| rowCount++; |
| } |
| } |
| this.gridView.MasterGridViewTemplate.GroupByExpressions.Add("[StatusColumn] Group By [StatusColumn]"); |
| } catch (Exception ex) { |
| messageToolTip1.ShowExceptionMessage(ex); |
| logger.Error(ex); |
| } |
| CleanUpLoadingWorker(); |
| } |
| void OnGroupSumaryEvaluate (object sender, Telerik.WinControls.UI.GroupSummaryEvaluationEventArgs e) { |
| try { |
| if (e.FormatString.ToLower().Contains("status")) { |
| e.FormatString = "STATUS STANDING : {0}"; |
| this.gridView.MasterGridViewTemplate.ExpandAllGroups(); |
| } |
| } catch (Exception ex) { |
| messageToolTip1.ShowExceptionMessage(ex); |
| logger.Error(ex); |
| } |
| } |