using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.MySqlClient;
using System.Web.Configuration;
using System.Text.RegularExpressions; 


public partial class searchClass : System.Web.UI.Page
{
	MysqlHelp mh = null;
	DataTable dt = null;
	string classStr = "";
		
	protected void Page_Load(object sender, EventArgs e)
    {
		///创建数据连接对象：
		mh = new MysqlHelp();
		
		///获取栏目名称className和栏目模板文件themeFile:
		DataTable classNameDt = new DataTable();
		classNameDt = mh.GetDatabysql("Select * From Class4DeepSoon Where OutLinkHref='' and FatherID=0 Order By Id Limit 6");
		int sumCount = classNameDt.Rows.Count;
		classStr += "<div class='menuClassFocus' id='Menu0' onClick='setClass(0,"+sumCount+",-1)'>全部</div>";
		if( sumCount > 0){
			for(int i = 0 ; i < sumCount ; i++)
			{
				string NameStr = classNameDt.Rows[i]["Name"].ToString();
				string IDStr = classNameDt.Rows[i]["ID"].ToString();
				classStr += "<div class='menuClass' id='Menu"+(i+1)+"' onClick='setClass("+(i+1)+","+sumCount+","+IDStr+")'>"+NameStr+"</div>";
			}
		}
		classStr += "<div class='menuClass'>更多</div>";
		this.labelClass.Text = classStr;
		
		this.btnSearch.Attributes.Add("onClick", "hiddFieldSelClass.value = document.getElementById('selClassHidden').value;hiddFieldMenuID.value = document.getElementById('menuIDHidden').value;"); 
    }
	
	protected void btnSearch_Click(object sender, EventArgs e)
	{		
		string keyWord = this.keyWord.Text;
		string selClass = this.hiddFieldSelClass.Value;
		string menuID = this.hiddFieldMenuID.Value;
		if(keyWord != "")
		Response.Redirect("searchResult.aspx?Key="+keyWord+"&ClassID="+selClass+"&MenuID="+menuID);
	}
		
	
}