WebGrid Community Server

Welcome to WebGrid Community Server Sign in | Join | Help
in Search

Need to fill in my WebGrid with a DataTable.

Last post 08-07-2009, 17:03 by FENIX. 2 replies.
Sort Posts: Previous Next
  •  07-31-2009, 22:47 1077

    Need to fill in my WebGrid with a DataTable.

    I am using a web service to return three datatables: 1 personal information, 1 contact info, and 1 other. I was wondering if there is any code out there or any suggestions on how I actually bind the data tables to the WebGrid. Thanks.
  •  07-31-2009, 23:23 1078 in reply to 1077

    Re: Need to fill in my WebGrid with a DataTable.

    Hi,

    Please see WebGrid starter kits there is an example called "OleDBDataAdapter/DataTable support"

    Olav Botterli, WebGrid Founding Developer

    Learn more with WebGrid Support Kit or Subscribe to WebGrid Announcements
  •  08-07-2009, 17:03 1080 in reply to 1078

    Re: Need to fill in my WebGrid with a DataTable.

    I'm doing samething rigth now, you can use this code to use xml web service respond to create a databale and use it as datasource for your grid.

    //read xml string
    StringReader sr = new StringReader(xml);
    XmlTextReader xmlTr = new XmlTextReader(sr);

    //load xml data in dataset
    DataSet ds = new DataSet();
    ds.ReadXml(xmlTr);

    //load xml data in grid
    wgTest.SetDataSource(ds.Tables[0]);
    wgTest.DataSource = ds.Tables[0];

    The problem I have now is that the search option funcitonality in the grid column (dropdown list filter at the top) is dissapearing, if you can find a way to keep it working you will save me man

    Hope it helps

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems