I would like to take a cell in a datagrid that will display a date and format it as such.
Currently is : 2011/12/31
Would like it to be: 12/31/11
I have this code which is formatting my headers correctly(thanks to help I received in this forum). Is there something I can do with this code to format the actual cells?
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 = 155; ts.GridColumnStyles.Add(customername); DataGridColumnStyle checkdate = new DataGridTextBoxColumn(); checkdate.MappingName = "CheckDate"; checkdate.HeaderText = "Date"; checkdate.Width = 70; 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); }




Reply With Quote