protected static Regex RCountry = new Regex(@"^[A-Za-z]{2}$");
if (!RCountry.IsMatch(Txt_DeliverContactor.Text))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('只能输入字母!')</script>");
}
就是输入字母也会提示~正则式用验证控件是可以通过的
该怎么改
解决方案 »
- 客户端IE浏览器内存泄漏问题,请各位前辈高手帮忙看看
- 如何使用VS2010开发手机web 网站?
- 一个关于datalist导出到excel的问题
- c#写的OCX如何与HTML页面中的javascript交互!如何在OCX中进行处理,才能让这三行在html文件中的js代码被触发?
- asp.net ajax到底怎么样?
- "插入记录时的 字符串转换" 初学者的问题.大家帮帮我!
- 关于SOAP的菜鸟级问题!!!!!!!!
- 还是DataGrid问题!请教了!!比较急!
- datalist问题
- 如何在ASP.NET中引用一个用C#写的DLL
- asp.net下拉列表框选择表格名称给sqldatasource+Gridview做参数有选择的打开表,如何在编辑模式下添入数据后更新数据?求CSDN高手指点!
- 悲剧啊,求高手指点下,关于cookie问题
if (RCountry.IsMatch(Txt_DeliverContactor.Text))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('只能输入字母!')</script>");
}
if (RCountry.IsMatch(Txt_DeliverContactor.Text.ToLower()))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('只能输入字母!')</script>");
}
if (RCountry.IsMatch(Txt_DeliverContactor.Text.ToLower()))
{}
Regex reg = new Regex(@"(?i)^[a-z]{2}$");
if (reg.IsMatch(str))
Response.Write("true");
else
Response.Write("false");
要不把 Text 也输出看一下是不是传输错误
或者用 Match 方法看它到底匹配出什么了
protected static Regex RCountry = new Regex(@"^[A-Za-z]{2}$");
if (RCountry.IsMatch(Txt_DeliverContactor.Text))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('只能输入字母!')</script>");
}