问题描述
button1和button2不管用,帮忙看看:usingSystem;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Web;usingSystem.Web.SessionState;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.HtmlControls;usingSystem.Data.OleDb;usingxinyun.classes.bases;namespacexinyun.aspx.maintain.mustread.parentmessage{///<summary>///guestbook_main的摘要说明。///</summary>publicclassbook_look:System.Web.UI.Page{protectedSystem.Web.UI.WebControls.Labelname;protectedSystem.Web.UI.WebControls.Labelcontent;protectedSystem.Web.UI.WebControls.TextBoxreplytime;protectedSystem.Web.UI.WebControls.TextBoxreplycontent;protectedSystem.Web.UI.WebControls.ButtonButton1;protectedSystem.Web.UI.WebControls.ButtonButton2;protectedSystem.Web.UI.WebControls.ImageButtonbtnSelectDate;protectedSystem.Web.UI.WebControls.Labeldianhua;protectedSystem.Web.UI.WebControls.Labelmail;protectedSystem.Web.UI.WebControls.ButtonButton3;privateOleDbConnectioncn=newOleDbConnection();privatevoidPage_Load(objectsender,System.EventArgse){if(!IsPostBack){CDataBind();}Tools.IncludeJsFile(this);this.Button3.Attributes.Add("onclick","window.returnValue='false';window.close();returnfalse;");//退出Tools.ShowCalendar(this.btnSelectDate,this.replytime);}privatevoidCDataBind(){//stringAddtime=DateTime.Now.ToString().Substring(0,10);intCID=Convert.ToInt32(Request.QueryString["id"].Trim());cn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+Server.MapPath("../../../../db/xinyun.mdb");//取得数据库路径//stringdbPath=System.Configuration.ConfigurationSettings.AppSettings["lyb"];//定义连接字符串//stringACconnStr="Provider=Microsoft.Jet.OleDb.4.0;DataSource="+Server.MapPath(dbPath);//创建数据库对像//OleDbConnectionACconn=newOleDbConnection(ACconnStr);//数据库操作try{cn.Open();//ACconn.Open();//取得所需操作的记录ID//定义SQL语句stringACsql="select*fromlybwhereid="+CID;//创建Command对像OleDbCommandACcomm=newOleDbCommand(ACsql,cn);//通过执行Command实例化DataReader类OleDbDataReaderACdr=ACcomm.ExecuteReader();if(ACdr.Read()){this.name.Text=ACdr["name"].ToString();this.dianhua.Text=ACdr["dianhua"].ToString();this.mail.Text=ACdr["mail"].ToString();this.content.Text=ACdr["content"].ToString();this.replytime.Text=ACdr["replytime"].ToString();this.replycontent.Text=ACdr["replycontent"].ToString().Replace("rn","<br>");//this.Addtime.Text=ACdr["Addtime"].ToString().Substring(0,8);//this.Addtime.Text=ACdr["Addtime"].ToString("yyyy-MM-dd");ACdr.Close();}else{Response.Write("对不起,请先填加留言");}}catch(Exceptionex){Response.Write(ex.ToString());}finally{cn.Close();}}#regionWeb窗体设计器生成的代码overrideprotectedvoidOnInit(EventArgse){////CODEGEN:该调用是ASP.NETWeb窗体设计器所必需的。//InitializeComponent();base.OnInit(e);}///<summary>///设计器支持所需的方法-不要使用代码编辑器修改///此方法的内容。///</summary>privatevoidInitializeComponent(){this.btnSelectDate.Click+=newSystem.Web.UI.ImageClickEventHandler(this.btnSelectDate_Click);this.Button1.Click+=newSystem.EventHandler(this.Button1_Click);this.Button2.Click+=newSystem.EventHandler(this.Button2_Click);this.Button3.Click+=newSystem.EventHandler(this.Button3_Click);this.Load+=newSystem.EventHandler(this.Page_Load);}#endregionprivatevoidButton1_Click(objectsender,System.EventArgse){cn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+Server.MapPath("../../../../db/xinyun.mdb");//取得数据库路径//stringdbPath=System.Configuration.ConfigurationSettings.AppSettings["lyb"];//定义连接字符串//stringACconnStr="Provider=Microsoft.Jet.OleDb.4.0;DataSource="+Server.MapPath(dbPath);//创建数据库连接对像//OleDbConnectioncn=newOleDbConnection(ACconnStr);//操作数据库try{intCID=Convert.ToInt32(Request.QueryString["id"].Trim());cn.Open();//定义所需SQLstringACsql="Updatelybsetname='"+name.Text+"',content='"+this.content.Text+"',replycontent='"+this.replycontent.Text.ToString().Replace("rn","<br>")+"',replytime='"+this.replytime.Text+"'whereid="+CID;//创建Command对像OleDbCommandACcomm=newOleDbCommand(ACsql,cn);ACcomm.ExecuteNonQuery();stringACqq="UpdatelybsetIsReplyed='1'whereid="+CID;OleDbCommandACcomm1=newOleDbCommand(ACqq,cn);ACcomm1.ExecuteNonQuery();Response.Write("<script>alert('留言回复成功');opener.location.href=opener.location.href;close();</script>");//Response.Redirect("");}catch(Exceptionex){Response.Write(ex.ToString());}finally{cn.Close();}}privatevoidButton2_Click(objectsender,System.EventArgse){this.replytime.Text="";this.replycontent.Text="";}privatevoidbtnSelectDate_Click(objectsender,System.Web.UI.ImageClickEventArgse){}privatevoidButton3_Click(objectsender,System.EventArgse){}}}
解决方案
解决方案二:
什么叫做不管用,是你点击后没有执行事件么?
解决方案三:
就是点击后没有执行事件的意思。
解决方案四:
这样的事,我最近也碰到过好几次,每次找半天都找不到毛病,到最后只好重新做个页面
解决方案五:
看看你的ASPX那个文件内容,包含两个button的页面.
解决方案六:
删掉BUTTON,从新添加一遍看看
解决方案七:
楼主的前台页面代码贴出来看看
解决方案八:
重新创建一下button
解决方案九:
感觉lz的写法好复杂啊;vs2003开发的?调试一下看看是不是语句没有执行?
解决方案十:
是好复杂..可以断点调试下啊
解决方案十一:
唉!放了个周末,就又有反应了啊。可能是机器也累了吧。不过还是谢谢大家的。