Posted By

rengber on 08/16/09


data xml c aspnet GridView

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


DataBinding an Arbitrary XML String to an ASP.Net GridViev

 / Published in: C#

Definitely falls into the category of "simple thing I shoulda memorized years ago", but whatever:

  1. DataSet ds = new DataSet();
  2. string xml = GetSomeXMLFromWherever();
  4. ds.ReadXml(new StringReader(xml), XmlReadMode.InferSchema);
  5. GridView1.DataSource = ds;
  6. GridView1.DataBind();

Report this snippet  

You need to login to post a comment.