xml| process
First step: Create the DB folder in the project file and create the Db.xml document in the DB folder. Db.xml structure contains only:<group></group>
Step Two: Create a new message and display two images: Messageadd.aspx and messagelist.aspx. Below are two pages of foreground and background source.
1.messageadd.aspx
}
#region Web Form Designer generated code
Override protected void OnInit (EventArgs e)
{
//
CodeGen: This call is required for the ASP.net Web forms Designer.
//
InitializeComponent ();
Base. OnInit (e);
}
<summary>
Designer supports required methods-do not use the Code editor to modify
The contents of this method.
</summary>
private void InitializeComponent ()
{
This. Button1.Click + = new System.EventHandler (this. Button1_Click);
This. Load + = new System.EventHandler (this. Page_Load);
}
#endregion
private void Button1_Click (object sender, System.EventArgs e)
{
private void Page_Load (object sender, System.EventArgs e)
{
FileStream stream = new FileStream (Server.MapPath ("Db\\db.xml"), FileMode.Open);
Try
{
XmlDataDocument doc = new XmlDataDocument ();
Doc. DataSet.ReadXML (new StreamReader (stream));
if (Doc. DataSet.Tables.Count!= 0 && Doc. Dataset.tables[0]. rows.count!=0)
{
Datalist1.datasource = doc. Dataset.tables[0]. DefaultView;
Datalist1.databind ();
}
Stream. Close ();
}
catch (Exception ding)
{
Response.Write (Ding. message);
}
Finally
{
Stream. Close ();
}
}
#region Web Form Designer generated code
Override protected void OnInit (EventArgs e)
{
//
CodeGen: This call is required for the ASP.net Web forms Designer.
//
InitializeComponent ();
Base. OnInit (e);
}
<summary>
Designer supports required methods-do not use the Code editor to modify
The contents of this method.
</summary>
private void InitializeComponent ()
{
This. Load + = new System.EventHandler (this. Page_Load);
}
#endregion
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.