Getting Gridview to read an XML file

H

hal

Hello All,
I have a windows form with a gridview control and i'm trying to get the
gridview to read the entire XML file. Anyone have any ideas on how to
do this? Below is some code so you can see what I'm trying to do.

private void btnBuildList_Click(object sender, EventArgs e)
{
string getCustomer = GetCustomer(txtLastName.Text,
txtFirstName.Text, txtUserID.Text);
Class1 ds = new Class1();
System.IO.StringReader s = new
System.IO.StringReader(getCustomer);

ds.ReadXml(s);

usersGridView.DataSource = ds;
usersGridView.DataMember = ds.DataTable.ToString();
}

Thanks
 
G

Galcho[MCSD.NET]

try this

//getCustomer must be XML
string getCustomer = GetCustomer(txtLastName.Text,
txtFirstName.Text, txtUserID.Text);

DataSet ds = new DataSet();

ds.ReadXml(s);

usersGridView.DataSource = ds;
usersGridView.DataMember = ds.Tables[0].Name;
//or
usersGridView.DataSource = ds.Tables[0];


hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com
 

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