2016-07-01 52 views

回答

0

問題是,這就是Web表單如何管理它與服務器的事件 - 正如我理解的那樣(糾正我,如果我錯了)。改爲使用html 5。您可以使用查詢字符串將頁面回發到服務器的同一網址,然後在服務器上獲取查詢字符串。不是最好的解決方案,但它的工作;它看起來與此類似:

在你的頁面:

<form id="aForm"> 
    <button id="abutton" type"submit" formaction="thisPage.aspx?redirect=true">click me</button> 
</form> 

在服務器上的網頁加載事件:

if (IsPostBack) { 
    object something = Request.QueryString["redirect"]; 
    if (something == null) 
     //not redirecting 
} 
相關問題