一般情况下使用Ajax是最好的选择,但你要求传到当前页面,用Ajax的话传递到其他页面很简单,传递到当前页面就有点麻烦了,这种情况下推荐使用Cookie,代码如下:
前台页面,用JS将要传递的参数存到Cookie里:
2. 后台按钮点击事件,读取Cookie里的参数值:
protected void Button1_Click(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["name"];
string name = cookie.Value;
}
用Ajax啊,不知道百度一下Ajax。