You must Sign In to post a response.
  • Category: ASP.NET

    How to bind data from remote location to Gridview.

    Hi techies,

    I have one windows form application in that i provide one textbox for entering URL and on click of Go button data from URL should be come into data table and bind that data table to Grid view.

    url eg-
  • #765455
    What data you want to download ? is it XML ? if yes then you can download it using webclient class, this class provide common methods for sending data to and receiving data from a resource identified by a URI.
    use 'WebClient.DownloadFile Method ' to download file and then you can bind that file to gridview directly OR you can use WebClient.DownloadFileAsync Method, it Downloads the specified resource to a local file as an asynchronous operation and returns a task object. These methods do not block the calling thread.
    see below code to bind xml to dataset and then dataset to gridview

    //read xml and load dataset
    XmlReader xmlFile ;
    xmlFile = XmlReader.Create("Product.xml", new XmlReaderSettings());
    DataSet ds = new DataSet();
    //load gridview
    gridview1.datasource = ds.Tables[0];

    Hope it helps

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765457
    Thank you #Prasad kulkarni.
    it is working fine i am getting data into dataset using webclient.downloadfile(,) method.

  • #765470
    Use Webclient Method download string it will come the data in string format if it is a xml data you can load in to the datatable and then bind below the url you can visit in dotnetspider.


  • Sign In to post your comments