我的本意是判断textbox中输入的字符串是否符合时间日期yyyy-MM-dd HH:mm格式
可是当我输入错误的格式时Command1_Click中的代码仍然会执行!这意味这程序先执行了Command1_Click中的代码才去判断textbox中的格式不正确!
那位大哥大姐能告诉我这是怎么回事,见鬼了@!@@!
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %><html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:Form id="Form1" runat="server">
<mobile:TextBox ID="TextBox1" Runat="server">
</mobile:TextBox>
<mobile:RegularExpressionValidator ID="RegularExpressionValidator1" Runat="server"
ControlToValidate="TextBox1" ErrorMessage="格式错误!" ValidationExpression="^(\d{4})(-)(\d{2})(-)(\d{2})(\s+)(\d{2})(:)(\d{2})$">
</mobile:RegularExpressionValidator>
<mobile:Command ID="Command1" Runat="server" OnClick="Command1_Click">Command</mobile:Command> </mobile:Form>
</body>
</html>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;public partial class _Default : System.Web.UI.MobileControls.MobilePage
{
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Command1_Click(object sender, EventArgs e)
{
Response.Write("<script>alert('abc!')</script>");
}
}
可是当我输入错误的格式时Command1_Click中的代码仍然会执行!这意味这程序先执行了Command1_Click中的代码才去判断textbox中的格式不正确!
那位大哥大姐能告诉我这是怎么回事,见鬼了@!@@!
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %><html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:Form id="Form1" runat="server">
<mobile:TextBox ID="TextBox1" Runat="server">
</mobile:TextBox>
<mobile:RegularExpressionValidator ID="RegularExpressionValidator1" Runat="server"
ControlToValidate="TextBox1" ErrorMessage="格式错误!" ValidationExpression="^(\d{4})(-)(\d{2})(-)(\d{2})(\s+)(\d{2})(:)(\d{2})$">
</mobile:RegularExpressionValidator>
<mobile:Command ID="Command1" Runat="server" OnClick="Command1_Click">Command</mobile:Command> </mobile:Form>
</body>
</html>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;public partial class _Default : System.Web.UI.MobileControls.MobilePage
{
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Command1_Click(object sender, EventArgs e)
{
Response.Write("<script>alert('abc!')</script>");
}
}
解决方案 »
- 一个关于网站根目录的问题
- 调用C的dll,总出现错误"accessviolationexception"访问受保护内存,怎样能解决?
- 再问QQ客服功能的问题?
- 这是怎么回事?晕哦の
- 一个SQL语句。。。。。请教
- 关于图像存储的问题(30分)
- 如何实现ASPX页中.一部分的内容会刷新,一部分不会刷新...
- 在编译网站的时候,他怎么弹出这个对话框啊?Visual Studio 实时调试器对话框,说什么,IEXPLORE.EXE[3348]中发生未处理的win32异常,不知
- 在线等待关于frame
- Invalid length for a Base-64 char array or string
- 判断来访者如何实现
- 如何将gridview的值插入到数据库另外一个表呢?
ControlToValidate="TextBox1" ErrorMessage="格式错误!" ValidationExpression="^(\d{4})(-)(\d{2})(-)(\d{2})(\s+)(\d{2})(:)(\d{2})$" ValidationGroup="T"><mobile:Command ID="Command1" Runat="server" OnClick="Command1_Click" ValidationGroup="T" >Command</mobile:Command>