hai to all
can any one help me out...
how to display the data from xml to gridview, where xml is in server(i.e in online)
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Krishna GaradRank #191 · 12.8K reputationPosted Jan 11, 2012, 7:19 AM EST
WebRequest rssReq = WebRequest.Create("Url With Xml File Path");
WebProxy px = new WebProxy("Proxy Url", true);
rssReq.Proxy = px;
rssReq.Timeout = 2000;
try
{
WebResponse rep = rssReq.GetResponse();
XmlTextReader xtr = new XmlTextReader(rep.GetResponseStream());
DataSet ds = new DataSet();
ds.ReadXml(xtr);
GridView1.DataSource=ds.Tables[0];
GridView1.DataBind();
}
catch
{
return null;
}
If it asking credentials then you must have to provide network credentials
NetWorkCredentials crd=new NetworkCredentials("Uname","Pwd");
and then send credentials with webrequest.
Krishna GaradRank #191 · 12.8K reputationPosted Jan 11, 2012, 4:22 AM EST
string _file = Server.MapPath("~/XMLFile.xml");
DataSet ds = new DataSet();
ds.ReadXml(_file);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
shashi reddy139 reputationPosted Jan 11, 2012, 4:29 AM EST
it worked for local xml..
but what i want is... xml file which is some where in server(url) ..i know the username and password..
now i wanna connect that xml file and i hve to show that xml data in a gridview
is it possible ..
Krishna GaradRank #191 · 12.8K reputationPosted Jan 11, 2012, 10:09 PM EST
If this help you please select Checkbox "This is correct answer"