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

首先设计一个容错提示的窗口图像为如下:

关键HTML文本如下:

“原因:``` =content[Int32.Parse(Request.QueryString["ms"])]

 1=content[Int32.Parse(Request.QueryString["ms"])]
 2```” 
 3
 4然后在代码编辑窗口中添加如下不分: 
 5
 6public class WebForm1 : System.Web.UI.Page   
 7{   
 8public string[] content;   
 9private void Page_Load(object sender, System.EventArgs e)   
10{   
11content=new string[10];   
12content[1]=".提示1.";   
13content[2]="提示2";   
14... ... 
15
16} 
17
18=========================================== 
19
20在容错的网页中这样调用: 
21
22[/*以下是一个示例!*/] 
23
24public void Check()   
25{//检测用户输入的合法性;   
26//检测[订单号][类型]是否为空白;   
27if (lOrderName.InnerText.Trim() == "" || lOrderCategory.InnerText.Trim() == "")   
28{   
29Response.Redirect(@"..\Exceptions.aspx?ms=11");   
30}   
31//判断用户输入的数量是否正确;   
32try   
33{   
34int i = Convert.ToInt16(tbQuantity.Text);   
35if (i ==0)   
36{   
37Response.Redirect(@"..\Exceptions.aspx?ms=12");   
38}   
39}   
40catch   
41{   
42Response.Redirect(@"..\Exceptions.aspx?ms=12");   
43}   
44//判断日期是否正确;   
45try   
46{   
47Convert.ToDateTime(tbTerm.Text);   
48}   
49catch   
50{   
51Response.Redirect(@"..\Exceptions.aspx?ms=9");   
52}   
53//判断交货期必须大于开单日期;   
54if (Convert.ToDateTime(tbTerm.Text) < Convert.ToDateTime(Request.Cookies["Order"].Values["Date"]))   
55{   
56Response.Redirect(@"..\Exceptions.aspx?ms=14");   
57}   
58//判断当前的型号在当前订单中是否已经存在;   
59DataClass dc = new DataClass();   
60if (dc.CheckModel(lOrderName.InnerText,lbModel.SelectedValue.ToString()))   
61{   
62Response.Redirect(@"..\Exceptions.aspx?ms=13");   
63}   
64//当订单类型为:“S-P”时,检测不能超出上限;   
65if (lOrderCategory.InnerText=="S-P")   
66{   
67if (Convert.ToInt32(tbQuantity.Text) > Convert.ToInt32(lbUpper.InnerText))   
68{   
69Response.Redirect(@"..\Exceptions.aspx?ms=18");   
70}   
71}   
72} 
73
74========================================== 
75
76其中Exceptions.aspx就是我们刚才定义的那个容错窗口了!```
77=content[Int32.Parse(Request.QueryString["ms"])]

=content[Int32.Parse(Request.QueryString["ms"])]

Published At
Categories with Web编程
Tagged with
comments powered by Disqus