2012-03-18 39 views
1

語言:VB, 環境:Visual Studio 2010中MultiView2.ActiveViewIndex不改變視圖

我有一個MultiView2一個DropDownList:視圖2,和如果下拉的選擇的索引是5,那麼該視圖應該更改爲View3,但不起作用,我將DropDown的AutoPostBack屬性設置爲True,兩個視圖都包含UpdatePanel。我在IF聲明中明確地指出了這一點,除了MultiView2.ActiveViewIndex = 1之外,其他所有內容都發射了。 這是到目前爲止我的代碼... 這是SelectedIndexChanged事件

If drpDownSecurityQuestion.SelectedIndex = 0 Then 
     txtAnswer.Enabled = False 
    ElseIf drpDownSecurityQuestion.SelectedIndex > 0 And drpDownSecurityQuestion.SelectedIndex < 5 Then 
     txtAnswer.Enabled = True 
    ElseIf drpDownSecurityQuestion.SelectedIndex = 5 Then 
     txtAnswer.Enabled = False 
     drpDownSecurityQuestion2.SelectedIndex = 5 
     MultiView2.ActiveViewIndex = 1 
    End If 
+0

我覺得你有一些錯誤的使用UpdatePanen。解釋你如何使用下拉菜單,更新面板和多視圖。告訴什麼是錯誤的是什麼? – 2012-03-18 18:23:54

+0

好吧,所以我在UpdatePanel中使用DropDown,在View中使用UpdatePanel,在MultiView中使用View。謝謝。 – user959631 2012-03-18 21:50:34

回答

1

現在很清楚下。你不能在updatepanel裏面發帖子。

附加回發觸發您的UpdatePanel:

+0

DropDown是UpdatePanel上的觸發器 – user959631 2012-03-19 14:12:19

+0

如果將它移到updatepanel範圍之外,您的drodown會引發事件嗎? – 2012-03-19 16:23:26

+0

是的,當在UpdatePanel和MultiView之外時,當SelectedIndex被改變時,MultiView2.ActiveIndex被觸發。但顯然,在UpdatePanel中使用它的原因是隻更新該部分,而不是整個頁面。 – user959631 2012-03-19 18:41:07