C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » XML »

Xml datas in gridview


Posted Date: 07 Oct 2009      Posted By: khan asif      Member Level: Bronze     Points: 1   Responses: 3



hi folks.,
if any one you tell me in steps as
how to display datas from a xml file to a gridview?
thanks





Responses

Author: seema    07 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DoBinding();
}
}

private void DoBinding()
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("albums.xml"));
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
}

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
DoBinding();
}
or refer this
http://www.dotnetjohn.com/articles.aspx?articleid=159



Author: khan asif    07 Oct 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

if i have a structure like this then how to display the value of name and location..

<employees>
<employee>
<emp>
<name>xxx</name>
<location>yyy</location>

</emp>
</employee>
<employees>



Author: Alwyn    13 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Khan,

<employees>
<employee>
<emp>
<name>xxx</name>
<location>yyy</location>

</emp>
</employee>
<employees>

this xml data is not well structured, this should be like

<employees>
<employee>
<name>xxx</name>
<location>yyy</location>
</employee>
<employees>

if u make it like this, it will work...

Thanks & Regards,
Alwyn Duraisingh.M



Post Reply
You must Sign In to post a response.
Next : Convert word document to xml using .net
Previous : Xml iteration
Return to Discussion Forum
Post New Message
Category: XML

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use