473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How to Synchronize 2 multiviews with menu control-Help needed

10
Hi, I am using these: ASP.Net 2.0, VB.Net, Visual Studio 2005, SQL Server 2005

In a asp.net page, I have two multiview controls each has 2 views & its corresponding 2 menu items named Metric & Imperial. Individually both works fine.

But when I click "Metric", the other "Metric" should also be switched on and vice-versa for Imperial. How to achieve that?

The catch here is, one of the multiview control is inside a show/hide div with proper postback adjusted visibility.

Below ASP.Net page elements shows the first multiview

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. .header{cursor: hand; cursor:pointer;}
  3. #MasterCartonSpecs{display:none;}
  4. .tabs{position:relative;top:1px;left:10px;}
  5. .tab{border:solid 1px #C1C1C1;background-color:#eeeeee;padding:1px 3px;}
  6. .selectedTab{background-color:white;border-bottom:solid 1px white;}
  7. .tabContents{border:solid 1px #C1C1C1;padding:1px;background-color:white;}
  8. </style></head>
  9. <body>
  10.     <form id="form1" runat="server"> 
  11.  
  12. <asp:Menu ID="TabMenu1" Orientation="Horizontal" StaticMenuItemStyle-CssClass="tab" StaticSelectedStyle-CssClass="selectedTab" CssClass="tabs" OnMenuItemClick="TabMenu1_MenuItemClick" runat="server">
  13.    <Items>
  14.       <asp:MenuItem Text="Metric" Value="0" Selected="true" />
  15.       <asp:MenuItem Text="Imperial" Value="1" />
  16.    </Items>
  17. </asp:Menu>
  18. <div class="tabContents">  
  19.    <asp:MultiView ID="ProductSpecsMultiview" runat="server" ActiveViewIndex="0">
  20.       <asp:View ID="TabMenu1_Tab1" runat="server">
  21.           TabMenu1_Tab1 content
  22.       </asp:View>
  23.       <asp:View ID="TabMenu1_Tab2" runat="server">
  24.           TabMenu1_Tab2 content
  25.       </asp:View>
  26.    </asp:MultiView>
  27. </div>
Below ASP.Net page elements shows the second multiview

Expand|Select|Wrap|Line Numbers
  1. <a href="http://forums.asp.net/AddPost.aspx?ForumID=130#" class="header" onclick='ToggleDisplay("MasterCartonSpecs")'>Show more...</a><br /><br />
  2. <div id="MasterCartonSpecs">
  3.    <h3>Master Carton Specification</h3>
  4.    <asp:Menu ID="TabMenu2" Orientation="Horizontal" StaticMenuItemStyle-CssClass="tab" StaticSelectedStyle-CssClass="selectedTab" CssClass="tabs" OnMenuItemClick="TabMenu2_MenuItemClick" runat="server">
  5.       <Items>
  6.          <asp:MenuItem Text="Metric" Value="0" Selected="true" />
  7.          <asp:MenuItem Text="Imperial" Value="1" />
  8.       </Items>
  9.    </asp:Menu>
  10.    <div class="tabContents">  
  11.       <asp:MultiView ID="ProductSpecsDetailsMultiview" runat="server" ActiveViewIndex="0">
  12.          <asp:View ID="TabMenu2_Tab1" runat="server">
  13.              TabMenu2_Tab1 content
  14.          </asp:View>
  15.          <asp:View ID="TabMenu2_Tab2" runat="server">
  16.              TabMenu2_Tab2 content
  17.          </asp:View>
  18.       </asp:MultiView>
  19.    </div>
  20. </div> 
  21.  
  22.  
  23.  
  24. <input type="hidden" id="hiddenElement1" name="hiddenElement1" runat="server" />
  25. </form>
  26. <script language="JavaScript">
  27. <!--
  28. function ToggleDisplay(id)
  29. {
  30.  document.getElementById('<%= hiddenElement1.ClientID %>').value = '';
  31.  
  32.  var elem = document.getElementById(id);
  33.  
  34.  if (elem)
  35.  {
  36.   if (elem.style.display != 'block')
  37.   {
  38.    elem.style.display = 'block';
  39.   }
  40.   else
  41.   {
  42.    elem.style.display = 'none';
  43.   }
  44.  
  45.   document.getElementById('<%= hiddenElement1.ClientID %>').value = id + '~' + elem.style.display;
  46.  }
  47. }
  48. function windowOnLoad()
  49. {
  50.  var hiddenValue = document.getElementById('<%= hiddenElement1.ClientID %>').value;
  51.  var hiddenValueArray = hiddenValue.split('~');
  52.  
  53.  if ( hiddenValueArray.length >= 2 )
  54.  {
  55.   var idValue = hiddenValueArray[0];
  56.   var styleDisplayValue = hiddenValueArray[1];
  57.  
  58.   document.getElementById(idValue).style.display = styleDisplayValue;
  59.  }
  60. }
  61. window.onload = windowOnLoad;
  62. // -->
  63. </script>
  64. </body>
Code behind:

Expand|Select|Wrap|Line Numbers
  1.     Protected Sub TabMenu1_MenuItemClick(ByVal sender As Object, ByVal e As MenuEventArgs)
  2.         Dim index As Integer = Int32.Parse(e.Item.Value)
  3.         ProductSpecsMultiview.ActiveViewIndex = index
  4.     End Sub
  5.     Protected Sub TabMenu2_MenuItemClick(ByVal sender As Object, ByVal e As MenuEventArgs)
  6.         Dim index As Integer = Int32.Parse(e.Item.Value)
  7.         ProductSpecsDetailsMultiview.ActiveViewIndex = index
  8.     End Sub

But when I click "Metric", the other "Metric" should also be switched on and vice-versa for Imperial. How to achieve that?
Apr 21 '09 #1
0 2034

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

Similar topics

8
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
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
6
by: Sandy | last post by:
Hello - I have a book that illustrates pulling menu items from a Sql Server table into an ascx via a stored procedure. Is this something that is done in the real world? I do like the effect...
7
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote...
2
by: Mark | last post by:
I started to use MS Visual Basic 2005 Express Edition to learn how to program in Visual Basic. This Express Edition saves projects in this path: C:\Documents and Settings\Username\My...
17
by: GS | last post by:
the main menu in the application seemed to disappeared all together until I click on an control and select mainmenu1 in designer. then the mainmenu1 displays where it should be but running it or...
5
by: Brad Isaacs | last post by:
Good morning friends, I am working with ASP.NET 2.0 -- VB code behind I have created tabbed pages using the Menu control with the Multiview control. Using the menu control to display the...
2
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more...
2
by: archu007 | last post by:
Hi frds i have nested multiviews and used menucontrol to navigate throught views this is my html code <asp:Menu ID="Menu1" Font-Bold="true" Orientation="Horizontal" ...
13
by: jmartmem | last post by:
Greetings, I am using Dreamweaver CS3 to design an ASP page that contains a Record Insertion Form. Within this form are two list/menu form fields that I would like to "synchronize". In other...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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,...
0
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...

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.