Asp.net MultiView2.ActiveViewIndex不';不要改变看法

Asp.net MultiView2.ActiveViewIndex不';不要改变看法,asp.net,vb.net,visual-studio,Asp.net,Vb.net,Visual Studio,语言:VB, 环境:VisualStudio2010 我在MultiView2:View2中有一个DropDownList,如果下拉列表的选定索引为5,那么视图应该更改为View3,但不起作用,我将下拉列表的AutoPostBack属性设置为True,这两个视图中都有updatePanel。显然,我在IF语句中包含了这一点,除了MultiView2.ActiveViewIndex=1之外,其他所有内容都会触发。 这是我到目前为止的代码。。。 这在SelectedIndexChanged事件下

语言:VB, 环境:VisualStudio2010

我在MultiView2:View2中有一个DropDownList,如果下拉列表的选定索引为5,那么视图应该更改为View3,但不起作用,我将下拉列表的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
如果drpDownSecurityQuestion.SelectedIndex=0,则
txtAnswer.Enabled=False
ElseIf drpDownSecurityQuestion.SelectedIndex>0和drpDownSecurityQuestion.SelectedIndex<5,然后
txtAnswer.Enabled=True
ElseIf drpDownSecurityQuestion.SelectedIndex=5然后
txtAnswer.Enabled=False
drpDownSecurityQuestion2.SelectedIndex=5
MultiView2.ActiveViewIndex=1
如果结束

现在一切都清楚了。你不能在updatepanel中提升帖子

将回发触发器添加到updatepanel:


我认为您在使用UpdatePanen时出错了。解释如何使用下拉菜单、updatepanel和multiview。告诉我们里面是什么?好的,我在UpdatePanel中有下拉列表,UpdatePanel在视图中,视图在多视图中。谢谢。下拉菜单是updatepanel上的一个触发器。如果将其移到updatepanel范围之外,下拉菜单将引发事件吗?是的,当位于updatepanel和MultiView之外时,当选定的索引更改时,MultiView2.ActiveIndex将触发。但是很明显,在UpdatePanel中使用它的原因是,只有那一部分被更新,而不是整个页面。好的,我会告诉你我想要实现什么,以及我是如何设置它的。用户创建一个帐户,需要一个安全问题,用户从下拉列表中选择一个,并将答案放在下面的文本框中,可以选择编写自己的问题,这就是第二个视图的用途。在安全问题之前,有一个密码文本框,当下拉列表中的SelectedIndex被更改时,它会重置,但不在UpdatePanel中,这是我不想要的。嘿,非常感谢你一直回复我,所以我会将你的帖子标记为正确答案并投票,但我现在已经修复了它,我刚换了控制器。我将多视图放在UpdatePanel中。