test1:
先说好这个做法是错误的,运行会报错,原因是因为重新定义页面的hp变量里面的所有控件都是空值,无法得到dropdownlist的当前值
using System;
using System.Web.SessionState;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;
public partial class HomePage_Manager : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//if (!IsPostBack)//!IsPostBack第一次访问该界面,返回true
//{
//}
if (Session["type"] != null)
{
ClientScript.RegisterStartupScript(this.GetType(), "themeSearch", "<script>themeSearch('" + Session["type"].ToString() + "')</script>");
}
}
[WebMethod]//js调用时要加上这一句
public static bool joinBtn()
{
bool b = false;
Theme t = new T