1.前台画面:在页面中加入form和runat = "server"的方法并加入触发事件
<form method="post" runat="server"> <a runat="server" onserverclick="ToTourDetail" href="javascript:void(0);" text='123' class="over"> </form>
2.后台cs代码
1 public void ToTourListByArea(object o, EventArgs e)
2 {
3 HtmlAnchor btn = o as HtmlAnchor;
4 var areaCode = btn.Attributes["text"];
5 Session["searchAreaCode"] = areaCode;
6 Response.Redirect("../TourList/Default.aspx");
7 }