473,480 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

nesting of multiviews in asp.net

28 New Member
Hi frds
i have nested multiviews and used menucontrol to navigate throught views
this is my html code
Expand|Select|Wrap|Line Numbers
  1.  
  2. <asp:Menu ID="Menu1"  Font-Bold="true" Orientation="Horizontal"  
  3.             StaticEnableDefaultPopOutImage="False"
  4.             OnMenuItemClick="Menu1_MenuItemClick"  runat="server" >
  5.             <StaticMenuItemStyle   CssClass=MenuCell ItemSpacing=0px  />
  6.             <StaticHoverStyle CssClass=MenuCellHover/>
  7.             <StaticSelectedStyle  CssClass=MenuCellSelected  ItemSpacing=0px />
  8.     </asp:Menu>
  9.         <asp:MultiView ID="mView1" runat="server" ActiveViewIndex="0">
  10.             <asp:View ID="View1" runat="server">
  11.                 <asp:Label ID="lblView1" runat="server" Text="U r in view1"></asp:Label>
  12.             </asp:View>
  13.             <asp:View ID="View2" runat="server">
  14.                 <asp:Label ID="lblView2" runat="Server" Text="U r in View2"></asp:Label>
  15.             </asp:View>
  16.             <asp:View ID="View3" runat="server">
  17.                 <asp:Label ID="Label1" runat="Server" Text="U r in View2"></asp:Label>
  18.             </asp:View>
  19.             <asp:View ID="View4" runat="server">
  20.                 <table>
  21.                    <tr>
  22.                       <td valign="top">
  23.                          <asp:Menu ID="SubMenu1" runat="Server" Orientation="Vertical"
  24.                                    StaticEnableDefaultPopOutImage="false" 
  25.                                    OnMenuItemClick="SubMenu1_MenuItemClick">
  26.                             <StaticMenuStyle CssClass="MenuCell" />
  27.                             <StaticHoverStyle CssClass=MenuCellHover />
  28.                             <StaticSelectedStyle CssClass=MenuCellSelected />
  29.                          </asp:Menu>
  30.                        </td>
  31.  
  32.                         <td>
  33.                             <table>
  34.                                 <tr>
  35.                                     <td>
  36.                                     <asp:MultiView ID="SubMultiView1" runat="server">
  37.                                             <asp:View ID="SubView1" runat="server">
  38.                                                 <asp:Label ID="lblSubView1" runat="server" Text="u r in submenu"></asp:Label>
  39.                                             </asp:View>
  40.                                             <asp:View ID="SubView2" runat="server">
  41.                                                 <asp:Label ID="lblSubView2" runat="server" Text="subview2"></asp:Label>
  42.                                             </asp:View>
  43.                                     </asp:MultiView>
  44.                                    </td>
  45.                                 </tr>
  46.                             </table>
  47.                         </td>
  48.                     </tr>
  49.                  </table>
  50.  
  51.  
  52.             </asp:View>
  53.  
  54.         </asp:MultiView>
  55.  

in code behind
Expand|Select|Wrap|Line Numbers
  1.  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.         If Not Page.IsPostBack Then
  3.             Dim index As Integer
  4.             For index = 0 To mView1.Views.Count - 1
  5.                 Menu1.Items.Add(New MenuItem(mView1.Views(index).ID, index.ToString()))
  6.             Next index
  7.             Menu1.Items(0).Selected = True
  8.         End If
  9.     End Sub
  10.     Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
  11.         mView1.ActiveViewIndex = Int32.Parse(e.Item.Value)
  12.     End Sub
  13.  
I'm able to display the main menu but i'm unable to display submenu which is in view4

can any one giv some idea how to proceed with this
thank u
Archu
Oct 10 '07 #1
2 5855
archu007
28 New Member
hi frs i tried n got the solution
here is the code for codebehind

Expand|Select|Wrap|Line Numbers
  1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.         If Not Page.IsPostBack Then
  3.             Dim index As Integer
  4.             Dim m As MultiView
  5.             Dim v As View
  6.             Dim i As Integer
  7.             For index = 0 To mView1.Views.Count - 1
  8.                 Menu1.Items.Add(New MenuItem(mView1.Views(index).ID, index.ToString()))
  9.             Next index
  10.             For Each v In mView1.Views
  11.                 m = DirectCast(v.FindControl("SubMultiView1"), MultiView)
  12.                 If v.Controls.Contains(m) Then
  13.                     'For Each m In v.Controls.Contains(m)
  14.                     For i = 0 To m.Views.Count - 1
  15.                         CType(v.FindControl("SubMenu1"), Menu).Items.Add(New MenuItem(m.Views(i).ID, i.ToString))
  16.                     Next
  17.                     'Next
  18.                 End If
  19.             Next
  20.             Menu1.Items(0).Selected = True
  21.         End If
  22.     End Sub
  23.     Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
  24.         mView1.ActiveViewIndex = Int32.Parse(e.Item.Value)
  25.     End Sub
  26.     Protected Sub SubMenu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles SubMenu1.MenuItemClick
  27.         'mView1.ActiveViewIndex = Int32.Parse(e.Item.Value)
  28.         Dim v As View
  29.         For Each v In mView1.Views
  30.             CType(v.FindControl("SubMultiView1"), MultiView).ActiveViewIndex = Int32.Parse(e.Item.Value)
  31.         Next
  32.     End Sub
  33.  
  34.  
if any modification to do plz let me know
or any other simple way to achieve this
thank u
Archu
Oct 10 '07 #2
Frinavale
9,735 Recognized Expert Moderator Expert
Thanks for sharing the solution Archu!
I'm glad you figured it out!

:) :)
-Frinny
Oct 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
7121
by: Michael Hertz | last post by:
I have hundreds of samples of XML documents on my harddisc. But all of them lack the one or another feature of XML. Some XML documents have no attributes some others are rather flat (nesting...
0
3096
by: Wolfgang Schwanke | last post by:
Dear usenet, I'm having the following small problem. I've been ask to add some Quicktime panoramas to a website. The author of the panoramas has made two versions of each: One in MOV format,...
8
3930
by: CoolPint | last post by:
I read in books that nested class cannot access private members of nesting class and vice versa unless they are made friends. Somehow, my compiler is letting my nested class member functions access...
8
2704
by: Stromboli | last post by:
Hi, I have my site available in a couple of languages most of the files are indexf.html (french), indexi.html (italian) and indexde.html (german).. I'd like to start using multiviews but I've...
8
2843
by: Hardrock | last post by:
I encountered some difficulty in implementing dynamic loop nesting. I.e. the number of nesting in a for(...) loop is determined at run time. For example void f(int n) { For(i=0; i<=K; i++)...
4
2119
by: kl.vanw | last post by:
I would like to count the nesting level in template classes. How can I make the following work? #include <assert.h> template <class T> class A { public: A() { // what goes here?
6
2626
by: stephen.cunliffe | last post by:
Hi, I'm looking for opinion/facts/arguments on the correct nesting of UL, OL, & LI elements. For example, this is what I want (unordered list): * Item 1 * Item 2 * Item 3
17
1887
by: henry | last post by:
Folks Here's a skeleton, generic HTML page, call it "index.php". You'll see a bit of php code in the middle: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
0
7048
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7050
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6743
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6966
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5344
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4787
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.