C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




ASP.net Gridview


Posted Date: 11 Jun 2008      Total Responses: 2

Posted By: rakhee       Member Level: Silver     Points: 1


How can we bind a gridview with xmldocument.NOT with xmlnodereader.
OTHER THANK THIS WAY>>>
objXmlReader = New XmlNodeReader(objOutputXml)
ds.ReadXml(objXmlReader)
If ds.Tables("COURSE").Rows.Count <> 0 Then
grid.DataSource = ds.Tables("COURSE")
grid.DataBind()

is der any other method ..please help




Responses

Author: Sujit Kumar    11 Jun 2008Member Level: GoldRating:     Points: 2
<%@ Page Language="C#" AutoEventWireup="true"%>
<script runat="server">
protected void Page_Load( object sender, System.EventArgs e )
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load("http://dotnet.aspx.cc/Rss.aspx");
XmlDataSource1.Data = doc.InnerXml;
XmlDataSource1.XPath = "/rss/channel/item";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server" DataSourceID="XmlDataSource1" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="????">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" Target="_blank" NavigateUrl='<%#XPath("link") %>'>
<%#XPath("title")%></asp:HyperLink>
[<%#(DateTime.Parse(XPath("pubDate").ToString().Replace("GMT",""))).ToString("yyyy?M?d?")%>]
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:XmlDataSource ID="XmlDataSource1" runat="server"></asp:XmlDataSource>
</form>
</body>
</html>




Author: Pavan Ravi    11 Jun 2008Member Level: GoldRating:     Points: 2
read the xml file into dataset using readxml method. Now, it is as simple that giving the dataset as datasource to the gridview.


Post Reply
You must Sign In to post a response.
Next : how to get IP address of the remote host
Previous : How to dynamically adjust the position of table?
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

budget conference call

Contact Us    Privacy Policy    Terms Of Use