使用XmlDocument 读取books.xml中的书名到DropDownList中。(4-2选作使用XmlReader读取books.xml中的书名到DropDownList中)
2012-12-20 18:37
435 查看
*******************Dome3.aspx
书名:<asp:DropDownList ID="DropDownList1"
runat="server" Height="28px" Width="136px">
</asp:DropDownList>
*******************Dome3.aspx.cs
public partial class Dome3 : System.Web.UI.Page
{
XmlDocument xdoc;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
xdoc = new XmlDocument();
xdoc.Load(Server.MapPath("books.xml"));
XmlNodeList list = xdoc.GetElementsByTagName("name");
foreach (XmlNode node in list)
{
this.DropDownList1.Items.Add(node.InnerText);
}
}
}
相关文章推荐
- 使用XmlDocument 读取books.xml中的书名到DropDownList中
- 使用XmlDocument 读取books.xml中的书名到DropDownList中
- 使用XmlDocument 读取books.xml中的书名到DropDownList中
- 5使用XmlDocument将dropdownlist中显示的书名的其它信息读入到相应的文本框中。
- 使用XmlReader和XmlDocument 读取xml文件,使用总结
- 使用XmlReader和XmlDocument 读取xml文件,使用总结
- 使用XmlDocument将dropdownlist中显示的书名的其它信息读入到相应的文本框中。
- 使用XmlDocument将dropdownlist中显示的书名的其它信息读入到相应的文本框中
- 使用XMLReader、XMLDocument和DataSet读取xml文件及效率
- 使用XmlDocument将dropdownlist中显示的书名的其它信息读入到相应的文本框中
- 使用XmlDocument将dropdownlist中显示的书名的其它信息读入到相应的文本框中。添加 :删除按钮,修改并保存按钮 和 添加按钮。完成这些按钮所对应的功能(XmlDocument)
- 使用XMLReader、XMLDocument和DataSet读取xml文件及效率
- 使用XmlDocument将dropdownlist中显示的书名的其它信息读入到相应的文本框中
- 使用XmlReader读取xml文件
- 使用XmlReader读取xml文件之二
- C#中使用XMLReader读取XML文件
- Silverlight使用XmlReader读取XML数据到TreeView中
- Java使用dom4j读取xml时报错:org.dom4j.DocumentException: Error on line 2 of document : Invalid byte 2 of 2-byte UTF-8 sequence. Nested exception: Invalid byte 2 of 2-byte UTF-8 sequence
- XML文件的读取用XmlDocument和XmlReader的比较
- 使用XmlReader读取xml文件