T
Trey
I am trying to create and load a datagrid at runtime. I am not having any
luck. The Datagrid shows up and one column which is about 50 wide shows up
with no header. What am I doing wrong? Here is my code.
dgcColLeft1 = new DataGridTextBoxColumn();
dgtsGridLeft = new DataGridTableStyle();
grdLeft = new DataGrid();
// Make the Grid
grdLeft.Location = new System.Drawing.Point(6, 6);
grdLeft.Size = new System.Drawing.Size(300, 300);
grdLeft.Dock = DockStyle.Fill;
grdLeft.CaptionVisible = false;
grdLeft.DataMember = "";
grdLeft.DataSource = dv; //dataview
grdLeft.Name = "GridLeft";
grdLeft.TableStyles.Add(dgtsGridLeft); // add table styles
// make the styles
dgtsGridLeft.DataGrid = this.grdLeft;
dgtsGridLeft.MappingName = "Services";
dgtsGridLeft.GridColumnStyles.Add(dgcColLeft1); // add the column
// make the column
dgcColLeft1.Format = "";
dgcColLeft1.FormatInfo = null;
dgcColLeft1.HeaderText = "Test this";
dgcColLeft1.MappingName = "ColumnLeft1Name";
dgcColLeft1.NullText = "";
dgcColLeft1.Width = 125;
luck. The Datagrid shows up and one column which is about 50 wide shows up
with no header. What am I doing wrong? Here is my code.
dgcColLeft1 = new DataGridTextBoxColumn();
dgtsGridLeft = new DataGridTableStyle();
grdLeft = new DataGrid();
// Make the Grid
grdLeft.Location = new System.Drawing.Point(6, 6);
grdLeft.Size = new System.Drawing.Size(300, 300);
grdLeft.Dock = DockStyle.Fill;
grdLeft.CaptionVisible = false;
grdLeft.DataMember = "";
grdLeft.DataSource = dv; //dataview
grdLeft.Name = "GridLeft";
grdLeft.TableStyles.Add(dgtsGridLeft); // add table styles
// make the styles
dgtsGridLeft.DataGrid = this.grdLeft;
dgtsGridLeft.MappingName = "Services";
dgtsGridLeft.GridColumnStyles.Add(dgcColLeft1); // add the column
// make the column
dgcColLeft1.Format = "";
dgcColLeft1.FormatInfo = null;
dgcColLeft1.HeaderText = "Test this";
dgcColLeft1.MappingName = "ColumnLeft1Name";
dgcColLeft1.NullText = "";
dgcColLeft1.Width = 125;