using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace RegistrationAndQuestionnaireGenerator
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string Path = HttpContext.Current.Server.MapPath("~/xmlData/ConfigContent.xml");
DataSet objDataSet = new DataSet();
objDataSet.ReadXml(Path);
this.gv_SuitList.DataSource = objDataSet.Tables[0];
this.gv_SuitList.DataBind();
objDataSet.Dispose();
}
}
}
本文介绍了一个使用ASP.NET WebForm从XML文件中读取数据并展示在一个表格中的示例。通过获取服务器上的XML配置文件路径,利用DataSet对象读取XML内容,并将数据绑定到GridView组件上。
1068

被折叠的 条评论
为什么被折叠?



