Data not show in grid help

P

paolol

Hi,
I try to load an XML file on a Grid but I don't see the data, only the
fields.
Any suggestion ??? code is :
DialogResult res=openFileDialog1.ShowDialog(this);
if (res==DialogResult.OK)
{
string fn=openFileDialog1.FileName;
dataset11.ReadXml(fn);
textBox1.Text=fn;
dataGrid1.DataSource=dataset11;
dataGrid1.DataMember="product";
dataGrid1.Enabled.Equals(true);
}

thanks,
paolol
 
N

Nicholas Paldino [.NET/C# MVP]

Paolol,

First off, you will want to change the call to the Enabled property to
be:

dataGrid1.Enabled = true;

Calling Equals does not set the value, rather, it performs a comparison.

Also, when you are setting the data source, I don't know if the columns
are autoconfigured. You might want to check the TableStyles property on the
grid to see if there are any column mappings (after you bind to the data).
If not, you will have to create the columns yourself.

Hope this helps.
 
P

paolol

Hi Nicholas,
I did the change, all the column show the correct label but still no
data are still visible on the grid :(

Thanks for the help.
Paolol


Nicholas Paldino [.NET/C# MVP] ha scritto:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top