Rajveer singh

Rajveer singh

  • 757
  • 1k
  • 239.7k

Can't read column in xml file or url

Oct 19 2015 2:13 AM
    Hi all,
            
               I am bind gridview from xml url  but not read name from xml file ;;;;;;;;
 
  My code is  cs.
 
 
WebRequest rssReq =
WebRequest.Create(" http://newsonair.nic.in/top_rss.asp");
//Create a Proxy
WebProxy px = new WebProxy("http://newsonair.nic.in/top_rss.asp", true);
//Assign the proxy to the WebRequest
rssReq.Proxy = px;
// Set the timeout in Seconds for the WebRequest
rssReq.Timeout = 50000;
try
{
//Get the WebResponse
WebResponse rep = rssReq.GetResponse();
//Read the Response in a XMLTextReader
XmlTextReader xtr = new XmlTextReader(rep.GetResponseStream());
DataSet ds = new DataSet();
ds.ReadXml(xtr);
Top_Stories.DataSource = ds.Tables[2];
Top_Stories.DataBind();
}
catch (Exception ex)
{
throw ex;
}
 
 
Error Is here 
 

DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'title'.

 
 
 plaese how to shortout this 
 
 
 
.Aspx code 
 
<asp:Repeater ID = "Top_Stories" runat = "server">
<ItemTemplate>
<table>
<tr>
<th>
<ul style="list-style-type:square; font-size:15px; color:#c678c3;"><li><asp:HyperLink ID="HyperLink2" runat="server" Font-Size="12px" Font-Bold="true" ToolTip="That External Link open will be new Window" CssClass="raj" Target="_blank" Width="100% " style="align:left; color:#050AF7;" NavigateUrl = '<%#Eval("link")%>' Text='<%# Eval("title") %>'></asp:HyperLink> </li></ul>
</th>
</tr>
<tr>
<%--<th><img style='FLOAT: left; MARGIN-RIGHT: 5px' height='100' width='100' alt="" src='<%# Eval("image") %>'/></th>--%>
<th>
<ul style="list-style-type:none;" ><li><asp:Label ID="lbl" CssClass="raj" runat="server" Font-Bold="false" Width="100%" Font-Size="11px" style="align:left; color:Black; " Text='<%# Eval("description") %>'></asp:Label></li></ul>
</th>
</tr><br />
</table>
</ItemTemplate>
</asp:Repeater>
 
 
 
 
 
 
 

Answers (3)