This code is not formatting the headers?
It is called from this snippet of code.Code:private void SetUpHoldTableStyles() { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = binding2.DataMember.ToString(); DataGridColumnStyle recordid = new DataGridTextBoxColumn(); recordid.MappingName = "RecordID"; //column 0 recordid.HeaderText = "#"; recordid.Width = -1; ts.GridColumnStyles.Add(recordid); DataGridColumnStyle customername = new DataGridTextBoxColumn(); customername.MappingName = "CustomerName"; customername.HeaderText = "Name"; customername.Width = 100; ts.GridColumnStyles.Add(customername); DataGridColumnStyle checkdate = new DataGridTextBoxColumn(); checkdate.MappingName = "CheckDate"; checkdate.HeaderText = "Date"; checkdate.Width = 20; ts.GridColumnStyles.Add(checkdate); DataGridColumnStyle paymenttype = new DataGridTextBoxColumn(); paymenttype.MappingName = "PaymentType"; paymenttype.HeaderText = "#"; paymenttype.Width = -1; ts.GridColumnStyles.Add(paymenttype); dgHolds.TableStyles.Clear(); dgHolds.TableStyles.Add(ts); }
There are rows returned and it does execute the SetUpHoldTablesStyles(). Any ideas what I have incorrect?Code:DataSet ds = new DataSet(); ds = client.GetHoldsHeader(strCompanyNum); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { //fill datagrid on the pnlHolds //dgHolds.DataSource = dt.DefaultView; binding2 = new BindingSource(); binding2.DataSource = ds; binding2.DataMember = "srmfthdr"; dgHolds.DataSource = binding2; SetUpHoldTableStyles(); }
THanks




Reply With Quote