2012-10-28 35 views
0

我有createuserwizard控件,它有4個步驟。當qeurystring中存在一些參數時,我想在步驟0中將它們設置爲contols,然後將activeindex設置爲下一步。我不喜歡這樣寫道:通過asp.net中QueryString中的參數在CreateUserWizard中設置步驟

if (!Page.IsPostBack) 
     { 
      if (!String.IsNullOrEmpty(Request["from"]) && !String.IsNullOrEmpty(Request["to"]) && !String.IsNullOrEmpty(Request["seek"]) && !String.IsNullOrEmpty(Request["livein"])) 
      { 
       ((DropDownList)RegisterUser.WizardSteps[0].FindControl("ddlGender")).SelectedValue = Request["seek"]; 
       ((TextBox)RegisterUser.WizardSteps[0].FindControl("txtAgeFrom")).Text = Request["from"]; 
       ((TextBox)RegisterUser.WizardSteps[0].FindControl("txtAgeTo")).Text = Request["to"]; 
       ((DropDownList)RegisterUser.WizardSteps[0].FindControl("ddlLive")).SelectedValue = Request["livein"]; 

       RegisterUser.ActiveStepIndex = 1; 
      } 
     } 

這工作,並設置當前步驟糾正一步,但問題是「上一步」按鈕不起作用,並沒有轉到步驟0

回答

1

上一頁按鈕被點擊ASP.NET中的WIZZARD控制有兩個事件哪火,在這種順序:

1)PreviousButtonClick

2)ActiveStepChanged

我的建議是 - 在這兩個事件中加入斷點,並確保兩個都在您點擊上一個時執行。

此外,如果你有我剛纔提到的兩個事件處理程序的任何代碼,確保它們不會重置ActiveStepIndex

相關問題