在处理xml文件时遇到了锁定问题
我从一个xml里面读一些数据,绑定成read.aspx,在read.aspx页面上有个按钮,点了之后会跳转到另外个end.aspx页面。可是必须要等end.aspx载入完成后,才能再次打开read.aspx页面
这是我在read.aspx PageLoad时做的事
private void Page_Load(object sender, System.EventArgs e)
{
XmlTextReader myreader = new XmlTextReader(Server.MapPath("statList.xml"));
XmlDocument doc = new XmlDocument();
doc.Load(myreader);
XmlNode Report;
XmlElement root = doc.DocumentElement;
Report = root.SelectSingleNode("reportclass/Report[@id="+strReportID+"]");
Label2.Text =Report.ChildNodes[0].Attributes["chineseName"].Value ;
//.
//初始化一个button,并加上gotoReport事件
Button mybut =new Button();
mybut.Command += new CommandEventHandler(this.gotoReport);
mybut.Text = " 确定 ";
mybut.Style.Add("margin-left","200");
Panel1.Controls.Add(mybut);
}
//点击按钮,跳转到end.aspx
private void gotoReport(Object sender, CommandEventArgs e)
{
string strParm = initParm();
//Label2.Text += strParm;
HttpContext.Current.Response.Redirect("end.aspx?strParm="+strParm,true);
}
{
XmlTextReader myreader = new XmlTextReader(Server.MapPath("statList.xml"));
XmlDocument doc = new XmlDocument();
doc.Load(myreader);
XmlNode Report;
XmlElement root = doc.DocumentElement;
Report = root.SelectSingleNode("reportclass/Report[@id="+strReportID+"]");
Label2.Text =Report.ChildNodes[0].Attributes["chineseName"].Value ;
//.
//初始化一个button,并加上gotoReport事件
Button mybut =new Button();
mybut.Command += new CommandEventHandler(this.gotoReport);
mybut.Text = " 确定 ";
mybut.Style.Add("margin-left","200");
Panel1.Controls.Add(mybut);
}
//点击按钮,跳转到end.aspx
private void gotoReport(Object sender, CommandEventArgs e)
{
string strParm = initParm();
//Label2.Text += strParm;
HttpContext.Current.Response.Redirect("end.aspx?strParm="+strParm,true);
}
一但end.aspx没有载入完成,read.aspx 也打不开了.不知道怎么回事...