473,520 Members | 3,160 Online
Bytes | Software Development & Data Engineering Community
+ 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 5869
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
7127
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 level=2). Furthermore there are XML samples which do not have duplicate elements with only different attribute values or all with the same attributes. I...
0
3098
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, which needs a Quicktime plugin, and one Java applet. He's also kindly supplied me with sample HTML code for each. The code looks like this...
8
3937
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 private members of nesting class. template <typename T> class Container { // NO friendship given to any other public: class ContainerIterator;
8
2710
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 noticed that search engines don't index index.html.en but they do index index.en.html. My question is, how can I configure multiviews to deliver...
8
2846
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++) For(i=0; i<=K; i++)
4
2123
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
2627
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
1892
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" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
0
7237
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7468
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7209
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7591
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5768
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
1681
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 we have to send another system
1
857
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.