新客网WWW.XKER.COM:致力做中国最专业的网络学院!
学院: 操作系统 - 网络应用 - 服务器 - 网络安全 - 工具软件 - 办公软件 - Web开发 - 数据库 - 网页设计 - 图形图像 - 媒体动画 - 硬件学堂 - 存储频道 - QQ专区
您的位置:首页 > 软件开发 > .Net开发 > Asp.net教程 > 正文:在WEB程序中设置个性化,容错提示窗口

在WEB程序中设置个性化,容错提示窗口

新客网 XKER.COM 2004-09-16 来源: 收藏本文
首先设计一个容错提示的窗口图像为如下:



关键HTML文本如下:

“原因:<%=content[Int32.Parse(Request.QueryString["ms"])]%>”

然后在代码编辑窗口中添加如下不分:

public class WebForm1 : System.Web.UI.Page
{
public string[] content;
private void Page_Load(object sender, System.EventArgs e)
{
content=new string[10];
content[1]=".提示1.";
content[2]="提示2";
... ...

}

===========================================

在容错的网页中这样调用:

[/*以下是一个示例!*/]

public void Check()
{//检测用户输入的合法性;
//检测[订单号][类型]是否为空白;
if (lOrderName.InnerText.Trim() == "" || lOrderCategory.InnerText.Trim() == "")
{
Response.Redirect(@"..\Exceptions.aspx?ms=11");
}
//判断用户输入的数量是否正确;
try
{
int i = Convert.ToInt16(tbQuantity.Text);
if (i ==0)
{
Response.Redirect(@"..\Exceptions.aspx?ms=12");
}
}
catch
{
Response.Redirect(@"..\Exceptions.aspx?ms=12");
}
//判断日期是否正确;
try
{
Convert.ToDateTime(tbTerm.Text);
}
catch
{
Response.Redirect(@"..\Exceptions.aspx?ms=9");
}
//判断交货期必须大于开单日期;
if (Convert.ToDateTime(tbTerm.Text) < Convert.ToDateTime(Request.Cookies["Order"].Values["Date"]))
{
Response.Redirect(@"..\Exceptions.aspx?ms=14");
}
//判断当前的型号在当前订单中是否已经存在;
DataClass dc = new DataClass();
if (dc.CheckModel(lOrderName.InnerText,lbModel.SelectedValue.ToString()))
{
Response.Redirect(@"..\Exceptions.aspx?ms=13");
}
//当订单类型为:“S-P”时,检测不能超出上限;
if (lOrderCategory.InnerText=="S-P")
{
if (Convert.ToInt32(tbQuantity.Text) > Convert.ToInt32(lbUpper.InnerText))
{
Response.Redirect(@"..\Exceptions.aspx?ms=18");
}
}
}

==========================================

其中Exceptions.aspx就是我们刚才定义的那个容错窗口了!

收藏】 【评论】 【推荐】 【投稿】 【打印】 【关闭
发表评论
要记得去论坛讨论,点击注册新会员匿名评论
评论内容:不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
阅读排行
随机推荐
实用信息推荐