Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 04, 2011 07:56 PM by budugu
Member
20 Points
23 Posts
Aug 04, 2011 05:50 PM|LINK
Hello .Net Community, would like to ask if anyone know the reason why mv.SetActiveView(myView1) would NOT display a particular view? Thanks.
All-Star
53942 Points
8147 Posts
Aug 04, 2011 05:57 PM|LINK
devtekguy why mv.SetActiveView(myView1) would NOT display a particular view?
Are you getting any errors? There could be many reasons.
You might have kept all the controls of the myView1 in a Panel WITH VISIBLE="FALSE".
Your might have kept the view controls in an updatepanel with UPDATEMODE="CONDITIONAL" but without any triggers
16846 Points
2756 Posts
Aug 04, 2011 06:14 PM|LINK
Compare your code against the sample code below. It is possible you might have some properties on the View configured improperly:
<asp:MultiView ID="mv" runat="server"> <asp:View ID="vw1" runat="server"> </asp:View> <asp:View ID="vw2" runat="server"> </asp:View> </asp:MultiView>
To set the active view, the code should be as follows:
'Set the "vw1" View to be visible and active: Me.mv.SetActiveView(Me.vw1)
If you continue to have problems, please post your code to help further.
Aug 04, 2011 07:17 PM|LINK
Thanks SanSan for your quick reply...
1) No errors, I have a BUTTON click that triggers the mv.SetActiveView(view1) BUT doesn't execute it for some reason.
2) Encasulating Panel VISIBLE is TRUE
3) UpdateMode=Always
Aug 04, 2011 07:27 PM|LINK
Thanks Atconway, I have a pretty much the same kind of code.
MY ASPX page:
<updatePanel runat="server">
<asp:Panel runat="server">
<asp:Button ID="btnDisplayDetails" runat="server" Text="Display Details" OnClick="btnDisplayDetails_Click" />
<asp:MultiView ID="mv" runat="server">
<asp:View ID="view1" runat="server">
</asp:View>
<asp:View ID="view2" runat="server">
</asp:MultiView>
</asp:Panel>
</updatePanel>
MY CODE BEHIND:
Protected Sub btnDisplayDetails_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.mv.SetActiveView(Me.view1)
End Sub
41108 Points
6019 Posts
Aug 04, 2011 07:56 PM|LINK
I don't see anything wrong with posted code. May be you are overriding this selection in some other code. Here is a working example..
<asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Button ID="btnDisplayDetails" runat="server" Text="Display Details" OnClick="btnDisplayDetails_Click" /> <asp:MultiView ID="mv" runat="server"> <asp:View ID="view1" runat="server"> <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton> </asp:View> <asp:View ID="view2" runat="server"> <asp:ImageButton ID="ImageButton1" runat="server" /> </asp:View> </asp:MultiView> </ContentTemplate> </asp:UpdatePanel>
Protected Sub btnDisplayDetails_Click(ByVal sender As Object, ByVal e As EventArgs) Me.mv.SetActiveView(Me.view2) End Sub
devtekguy
Member
20 Points
23 Posts
SetActiveView Issue
Aug 04, 2011 05:50 PM|LINK
Hello .Net Community, would like to ask if anyone know the reason why mv.SetActiveView(myView1) would NOT display a particular view? Thanks.
sansan
All-Star
53942 Points
8147 Posts
Re: SetActiveView Issue
Aug 04, 2011 05:57 PM|LINK
Are you getting any errors? There could be many reasons.
You might have kept all the controls of the myView1 in a Panel WITH VISIBLE="FALSE".
Your might have kept the view controls in an updatepanel with UPDATEMODE="CONDITIONAL" but without any triggers
atconway
All-Star
16846 Points
2756 Posts
Re: SetActiveView Issue
Aug 04, 2011 06:14 PM|LINK
Compare your code against the sample code below. It is possible you might have some properties on the View configured improperly:
<asp:MultiView ID="mv" runat="server"> <asp:View ID="vw1" runat="server"> </asp:View> <asp:View ID="vw2" runat="server"> </asp:View> </asp:MultiView>To set the active view, the code should be as follows:
If you continue to have problems, please post your code to help further.
devtekguy
Member
20 Points
23 Posts
Re: SetActiveView Issue
Aug 04, 2011 07:17 PM|LINK
Thanks SanSan for your quick reply...
1) No errors, I have a BUTTON click that triggers the mv.SetActiveView(view1) BUT doesn't execute it for some reason.
2) Encasulating Panel VISIBLE is TRUE
3) UpdateMode=Always
<div>I'm boggled by this BUG... any other ideas?</div> <div></div> <div></div>devtekguy
Member
20 Points
23 Posts
Re: SetActiveView Issue
Aug 04, 2011 07:27 PM|LINK
Thanks Atconway, I have a pretty much the same kind of code.
MY ASPX page:
<updatePanel runat="server">
<asp:Panel runat="server">
<asp:Button ID="btnDisplayDetails" runat="server" Text="Display Details" OnClick="btnDisplayDetails_Click" />
<asp:MultiView ID="mv" runat="server">
<asp:View ID="view1" runat="server">
</asp:View>
<asp:View ID="view2" runat="server">
</asp:View>
</asp:MultiView>
</asp:Panel>
</updatePanel>
MY CODE BEHIND:
Protected Sub btnDisplayDetails_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.mv.SetActiveView(Me.view1)
End Sub
budugu
All-Star
41108 Points
6019 Posts
Re: SetActiveView Issue
Aug 04, 2011 07:56 PM|LINK
I don't see anything wrong with posted code. May be you are overriding this selection in some other code. Here is a working example..
<asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Button ID="btnDisplayDetails" runat="server" Text="Display Details" OnClick="btnDisplayDetails_Click" /> <asp:MultiView ID="mv" runat="server"> <asp:View ID="view1" runat="server"> <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton> </asp:View> <asp:View ID="view2" runat="server"> <asp:ImageButton ID="ImageButton1" runat="server" /> </asp:View> </asp:MultiView> </ContentTemplate> </asp:UpdatePanel>Protected Sub btnDisplayDetails_Click(ByVal sender As Object, ByVal e As EventArgs) Me.mv.SetActiveView(Me.view2) End Sub"Don't be afraid to be wrong; otherwise you'll never be right."