displaying data in datagrid...?? 2nd try
-
Hi experts, I am trying to display data in a datagrid from a xml file. I have no problem reading the xml file, however when i try to display the data in a datagrid all i get is "null" values. I have bound my dataset to the datasource property but still dont know where im going wrong can anyone point me in the right direction??? Cheers :)
-
Hi experts, I am trying to display data in a datagrid from a xml file. I have no problem reading the xml file, however when i try to display the data in a datagrid all i get is "null" values. I have bound my dataset to the datasource property but still dont know where im going wrong can anyone point me in the right direction??? Cheers :)
A simple example:
//Load data from the XML document into a dataSet DataSet ds = new DataSet(); ds.ReadXml("99999.xml"); //Show all of the records instead of the table name and the "+" symbol this.dataGrid1.DataSource = ds.Tables[0].DefaultView; //No adding of new rows through dataview is to take place CurrencyManager cm = (CurrencyManager)this.BindingContext[this.dataGrid1.DataSource, this.dataGrid1.DataMember]; ((DataView)cm.List).AllowNew = false; //# of Rows (records) in the dataGrid this.dataGrid1.CaptionText = "Total Tasks: " + dataGrid1.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember].Count.ToString();
Hope this helps Regards, Polis Can you practice what you teach?