Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
First I will explain what I have as far as the Xml but as for the DataGridView I have no code as i can't seem to figure out the problem. I download source code from a web url http://www.someurl.com[^]. I then extract the links from the code and convert the list of links into an XML string. Now I have the XML but can't figure out how to write the XML to the DataGridView any help would be appreciated and I hope my question was thorough enough to understand.
Posted
Updated 22-Apr-11 15:00pm
v2
Comments
Sergey Alexandrovich Kryukov 22-Apr-11 21:03pm    
If is not the real URL, right? What do you want to achieve?
What do you mean "to write the XML to the DataGridView"? How it should be rendered and/or mapped onto DataGridView cells?
--SA
charles henington 22-Apr-11 21:12pm    
I use this code to get xml

<pre lang="cs">private string MakeXml()
{
string xml = string.Empty;
List<String> WebUrls = new List<String>();
string ExtractedSourceCode = null;
using (WebClient client = new WebClient())
{
ExtractedSourceCode = ASCIIEncoding.ASCII.GetString(client.DownloadData("http://www.feedzilla.com/rss.asp"));
}
string[] SeperatedLines = new string[] { };
SeperatedLines = ExtractedSourceCode.Split(SeperatedLines, StringSplitOptions.RemoveEmptyEntries);
foreach (string lines in SeperatedLines)
{
if (lines.StartsWith("href='rss"))
{
string ExtractedUrl = lines.Replace("><img", "");

WebUrls.Add(ExtractedUrl.Replace("href=", "http://www.feedzilla.com/").Replace("'", ""));
}
}
xml = "<RssItem>";
foreach (string RssUrl in WebUrls)
{
xml += "<Rss Url=\"" + RssUrl + "\"/>";
}
xml += "</RssItem>";

return xml;
}</pre>

Now I have the Urls in xml format a little more than 1600 links and i want to display them in one Column each lnk in its own row. that way on Row select I can make my Custom built TabPage Load which will load the browser in my tabpage to the text within the selected Row

1 solution

What it sounds like you have one level deep XML where only URLs are there at level 1. Somthing like:
XML
<RssItems>
  <RssUrl>someUrl1</RssUrl>
  <RssUrl>someUrl2</RssUrl>
  <RssUrl>someUrl3</RssUrl>
  <RssUrl>someUrl4</RssUrl>
  ....
  <RssUrl>someUrln</RssUrl>
<RssItems>

Just use this XML to convert into a Dataset.
Few links for it: Loading a DataSet from XML (ADO.NET)[^]
DataSet.ReadXml Method (XmlReader)[^]

Once you have dataset with you, just bind it to the grid. You can make datagrid columns like hyperlink at designtime. Try!
 
Share this answer
 
Comments
charles henington 23-Apr-11 17:00pm    
my 5, First link hit the spot although I had to alter the code a bit. Had to drop column, and change the XmlReadMode to InferSchema
Sandeep Mewara 24-Apr-11 1:42am    
Thanks.
charles henington 28-Apr-11 20:11pm    
Just thought you might want to know the xml schema that i use is
<RssItem><Rss Url="someUrl1"/><Rss Url="someUrl2"/></RssItem>
Sandeep Mewara 28-Apr-11 21:22pm    
:thumbsup:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900