GridView Read Line by Line with foreach

2 posts, 0 answers
  1. Tom
    Tom avatar
    1 posts
    Member since:
    Apr 2012

    Posted 15 Apr 2012 Link to this post

    I use the telerik GridView and read datas from a XML in this. Now I will write an XML from the GridView. I will read it same as a normaly windows list view element so this code i used for this:
    foreach (ListViewItem lvi in lvPending.Items)
    So my question how can I read this with a teleric grid view?
    foreach (GridDataItem item in RadGrid1.Items)

    doesn´t run. I got the error:The type or namespace name 'GridDataItem' could not be found (are you missing a using directive or an assembly reference?)  

    Thanks for help
  2. Stefan
    Stefan avatar
    2908 posts

    Posted 19 Apr 2012 Link to this post

    Hi Tom,

    Thank you for writing.

    For you scenario I will suggest that you read the XML into a DataSet and use its table as DataSource for RadGridView. Then, when you want to save the data back to the XML, again use the DataSet WriteXml method.

    More information regarding binding RadGridView to XML can be found here: 

    I hope that you find this information useful. Let us know is you have any other questions.
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top