namespace baoge.Admin
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
    using System.Data.OleDb;
	/// <summary>
	///		admin_search 的摘要说明。
	/// </summary>
	public class admin_search : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.TextBox key_word;
		protected System.Web.UI.WebControls.DropDownList search_type;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.CustomValidator Cv_id;
        protected string a="111";
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.Button1.Click += new System.EventHandler(this.Button1_Click);
			this.Cv_id.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Cv_id_ServerValidate);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Button1_Click(object sender, System.EventArgs e)
		{
			if(Page.IsValid)
			{
				Response.Redirect("admin_search.aspx?keyword="+this.key_word.Text.Trim()+"&search_type="+search_type.SelectedItem.Value);
			}
		}

		private void Cv_id_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
		{
			string check_word=key_word.Text.Trim();
			if(check_word.IndexOf("%")>=0 || check_word.IndexOf(",")>=0)
			{
				args.IsValid=false;
			}
			else
			{
				args.IsValid=true;
			}
		}
	}
}
