| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 427 人关注过本帖
标题:[求助]点击返回按钮无法返回
只看楼主 加入收藏
ld19821009
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-7-23
收藏
 问题点数:0 回复次数:0 
[求助]点击返回按钮无法返回

我现在做一个毕业设计是企业客户服务系统,
以下是其中一个“添加新记录信息“界面的代码,但是我点击代码中“返回“按钮时,没反应,转不到我要去得指定页,这是为什末?看颜色代码




我的qq号是635500852,如果详细说明的话,请加我qq!



namespace CustomerServiceSys.Modules
{
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

/// <summary>
/// RecordAddModule 的摘要说明。
/// </summary>
public class RecordAddModule :ModuleBase
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox ClientIdTextBox;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.TextBox CNameTextBox;
protected System.Web.UI.WebControls.Label Label9;
protected System.Web.UI.WebControls.TextBox PhoneTextBox;
protected System.Web.UI.WebControls.Label Label12;
protected System.Web.UI.WebControls.DropDownList LevelList;
protected System.Web.UI.WebControls.CustomValidator LevelCustomvalidator;
protected System.Web.UI.WebControls.Label Label14;
protected System.Web.UI.WebControls.TextBox RDetailsTextBox;
protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator2;
protected System.Web.UI.WebControls.Label Label17;
protected System.Web.UI.WebControls.DropDownList StatusList;
protected System.Web.UI.WebControls.CustomValidator StatusCustomvalidator;
protected System.Web.UI.WebControls.Label Label20;
protected System.Web.UI.WebControls.Label UserNameLabel;
protected System.Web.UI.WebControls.Label Label21;
protected System.Web.UI.WebControls.TextBox FinishDateTextBox;
protected System.Web.UI.WebControls.Label Label22;
protected System.Web.UI.WebControls.Label Label23;
protected System.Web.UI.WebControls.TextBox RemarksTextBox;
protected System.Web.UI.WebControls.Label Label24;
protected System.Web.UI.WebControls.RadioButtonList ResearchList;
protected System.Web.UI.WebControls.Label ShowMsg;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator7;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.Label NowTimeLabel;
protected System.Web.UI.WebControls.Button ReturnButton;
protected System.Web.UI.WebControls.Button SubmitButton;
protected System.Web.UI.WebControls.Image Image1;

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
//显示录入人信息
UserNameLabel.Text=HttpContext.Current.User.Identity.Name;
//显示登记时间
NowTimeLabel.Text=DateTime.Now.ToString();
}
}

//检验严重级别列表框是否填写
public void LevelNotNullValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{
if(LevelList.SelectedIndex==0)
{
args.IsValid =false;//未填写
}
else
{
args.IsValid =true;//已填写
}
}
//检验状态列表框是否填写
public void StatusNotNullValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{
if(StatusList.SelectedIndex==0)
{
args.IsValid =false;//未填写
}
else
{
args.IsValid =true;//已填写
}
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SubmitButton.Click += new System.EventHandler(this.SubmitButton_Click);
this.ReturnButton.Click += new System.EventHandler(this.ReturnButton_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void SubmitButton_Click(object sender, System.EventArgs e)
{
if(Page.IsValid)
{
//从文件Web.config中读取连接字符串
string sqldb= ConfigurationSettings.AppSettings["ConnectionString"];
//连接JdglSys数据库
SqlConnection Conn= new SqlConnection (sqldb);
Conn.Open ();
//利用Command对象调用存储过程
SqlCommand mycommand=new SqlCommand ("sp_InsertRecord",Conn);
//将命令类型转为存储类型
mycommand.CommandType =CommandType.StoredProcedure ;
//往存储过程中添加参数
mycommand.Parameters .Add ("@ClientName",SqlDbType.NVarChar);
mycommand.Parameters .Add ("@CPerson",SqlDbType.NVarChar);
mycommand.Parameters .Add ("@CTel",SqlDbType.NVarChar);
mycommand.Parameters .Add ("@RLevel",SqlDbType.NVarChar);
mycommand.Parameters .Add ("@RDetails",SqlDbType.NVarChar);
mycommand.Parameters .Add ("@RStatus",SqlDbType.NVarChar);
mycommand.Parameters .Add ("@LogPerson",SqlDbType.NVarChar);
mycommand.Parameters .Add ("@CreateDate",SqlDbType.DateTime);
mycommand.Parameters .Add ("@FinishDate",SqlDbType.DateTime);
mycommand.Parameters .Add ("@Remarks",SqlDbType.NVarChar);
mycommand.Parameters .Add ("@IsResearch",SqlDbType.Int);
//给存储过程的参数赋值
mycommand.Parameters ["@ClientName"].Value =ClientIdTextBox.Text.Trim();
mycommand.Parameters ["@CPerson"].Value = CNameTextBox.Text.Trim();
mycommand.Parameters ["@CTel"].Value =PhoneTextBox.Text.Trim();
mycommand.Parameters ["@RLevel"].Value =LevelList.SelectedIndex;
mycommand.Parameters ["@RDetails"].Value =RDetailsTextBox.Text.Trim();
mycommand.Parameters ["@RStatus"].Value =StatusList.SelectedIndex;
mycommand.Parameters ["@LogPerson"].Value =UserNameLabel.Text.Trim();
mycommand.Parameters ["@CreateDate"].Value =NowTimeLabel.Text.Trim();
if(FinishDateTextBox.Text=="")
mycommand.Parameters ["@FinishDate"].Value ="2000-1-1";
else
mycommand.Parameters ["@FinishDate"].Value =FinishDateTextBox.Text.Trim();
mycommand.Parameters ["@Remarks"].Value =RemarksTextBox.Text.Trim();
mycommand.Parameters ["@IsResearch"].Value =ResearchList.SelectedIndex;
try
{
mycommand.ExecuteNonQuery();
ShowMsg.Text="新客户记录添加成功";
ShowMsg.Style["color"]="green";
}
catch(SqlException error)
{
ShowMsg.Text="添加未成功,请稍后再试。原因:"+error.Message;
ShowMsg.Style["color"]="red";
}
//关闭连接
Conn.Close();
}
}

private void ReturnButton_Click(object sender, System.EventArgs e)
{
Response.Redirect(PathPrefix+"/RecordMan.aspx");
}


}
}

搜索更多相关主题的帖子: 客户服务 记录 信息 
2006-08-10 18:28
快速回复:[求助]点击返回按钮无法返回
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032084 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved