asp.netÎı¾¿òÑéÖ¤ÊäÈë
//ʹÓÃÑéÖ¤·½·¨
if (!InputValidator(txt.Text.Trim()))
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myScript", "alert('\"Îı¾¿ò\"ÊäÈëÁË·Ç·¨×Ö·û»òÊäÈ볬³¤£¡');", true);
return;
}
//ÑéÖ¤·½·¨
protected bool InputValidator(string inputStr)
{
//Ö»ÄÜÊäÈëÖÐÎÄ£¬Ó¢ÎÄ£¬Êý×Ö£¬ÖÐÓ¢Îıêµã(¹ýÂËÓ¢Îĵ¥ÒýºÅ)¡£
if (Regex.IsMatch(inputStr, "^[\u4e00-\u9fa50-9a-zA-Z_£¬¡££¿£º£»‘’£¡“”—……¡¢(£{2}) (£¨£©) (¡¾¡¿) ({}) (¡¶¡·)-,.?:;\"!`(\\-{2})(\\.{3})(\\(\\))(\\[\\])({})]{0,50}$"))
{
return true;
}
return false;
}
//js·½Ê½´¦Àí
var regExp=new RegExp("^[\u4e00-\u9fa50-9a-zA-Z_£¬¡££¿£º£»‘’£¡“”—……¡¢(£{2}) (£¨£©) (¡¾¡¿) ({}) (¡¶¡·)-,.?:;\"!`(\\-{2})(\\.{3})(\\(\\))(\\[\\])({})]{0,50}$");
if(!regExp.test(txt1.value))
{
alert('ÊäÈëÁË·Ç·¨×Ö·û»òÊäÈ볬³¤£¡');
txt1.focus();
return;
}
Ïà¹ØÎĵµ£º
ǰ̨´úÂ룺
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="articleview.aspx.cs" Inherits="articleview" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> ......
SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
SqlCommand cmdAdd = new SqlCommand( "Community_Disc ......
ÏÂͼÖкìÉ«¼ýÍ·ÊǸ¸Àà ¶øÇÒÊôÓÚ¸ùĿ¼¼¶±ð¡£
¡¡¡¡ÏÂÃæ¸ö×Ö¶ÎΪ£ºID¡¡¡¡¸¸ID¡¡ ÀàÐÍÃû³Æ¡¡ Éî¶È¡¡ ÅÅÐò
¡¡¡¡Ç°Ãæ3¸ö×Ö¶ÎûÓÐʲô¿É½âÊ͵ģ¬×ö¹ýÎÞÏÞ¼¶·ÖÀàÉè¼ÆµÄÈ˶¼Ó¦¸ÃÇå³þ
¡¡¡¡¶øµÚ5¸ö×Ö¶ÎÅÅÐò×Ö¶ÎID£º43µÄ23ÅÅÐò´ú±íËûÔÚÕâÕűíÅÅÔÚ23µÄ¸ùĿ¼
¡¡¡¡¶ø23ÏÂÃæµÄ23,01 ˵Ã÷ËûÊÇ2¼¶·ÖÀ࣬ÅÅÔÚ23ÏÂÃæµÄµÚ01¸ö£¬Ò²ÊÇÖ§³Ö99¼ ......
Ö÷Ìå¼Ü¹¹
¡¡¡¡¸÷ƵµÀ·Ö±ðλÓÚ²»Í¬µÄWeb Project(¾ßÓжÀÁ¢µÄ¶þ¼¶ÓòÃû)£¬²¢½«ËùÓеÄÒµÎñÂß¼ÒÔ¼°Êý¾Ý·ÃÎʹ¦ÄÜ·â×°³ÉClass Library£¬ËùÓÐÆµµÀ¹²ÓÃÕâ¸öClass Library¡£
¡¡¡¡ÏÂÃæÏêϸ½éÉÜʵÏÖ·½·¨¡£
¡¡¡¡¼ÙÉèÍøÕ¾ÓÐÈý¸öƵµÀ£¬ÐÂÎÅ¡¢ÂÛ̳ÒÔ¼°²©¿Í£¬¶ÔÓ¦µÄ¶þ¼¶ÓòÃûΪ"news"¡¢"forum"¡¢"blog"¡£³ý´ËÖ®Í⣬»¹ÐèÒªÁ ......
/// <summary>
/// ´´½¨Êý¾Ý¿â¡£
/// </summary>
/// <param name="srvName">±íÊ ......