CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 10/8/2007 4:40:24 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 35 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
dfour2
Asp.Net User
trouble linking A menu control using sitemap datasource to MultiView Control?10/8/2007 4:40:24 PM

0/0

Having trouble linking A menu control using sitemap datasource
to MultiView and View Web Server Controls

 

I need CustMultview( the multiview control) to use method SetActiveView
to get ViewID called from Menucontrol using selected menuitem Title or NavigateUrl

I know I need to add
// if (!IsPostBack)
// {

I want  (e.Item.text) to equal View view

 so I can utilize

// CustMultview.SetActiveView(view)

// to set the View ID

or should  I use
// protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
// {
// MultiView1.ActiveViewIndex = Int32.Parse(e.Item.Value);

? I not sure if I am making any sense.
all the Details are below. I would appreciate some assistance ASAP

[code-behind file- Browse2.aspx.cs]

 

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Customer_Browse2_aspx : System.Web.UI.Page
{
    protected void btnleft_MenuItemClick(Object sender, MenuEventArgs e)
    {
    // here is the problem!!
    }

}

 

 

[Sitmap file]

<?xml version="1.0" encoding="utf-8" ?>
<siteMap >
 <siteMapNode title="Home" url="Customer/Cust_home.aspx">
  <siteMapNode title="Consumables" url="Customer/browse2.aspx?Consumables" />
  <siteMapNode title="Services" url="Customer/browse2.aspx?Services" >
  </siteMapNode>
  <siteMapNode title="Training" url="Customer/browse2.aspx?Training" />
  <siteMapNode title="Support" url="Customer/browse2.aspx?Support" >
  </siteMapNode>
 </siteMapNode>
</siteMap>

 

 

[menu control]

<div class="stripes" style="left: 0px; top: 10px">
  </div>
  <div class="btnbar">
  <asp:menu id="btnleft" runat="server"
    datasourceid="SiteMapDataSource1"
    cssclass="btnleft"
    orientation="Horizontal"
    maximumdynamicdisplaylevels="0"
    Target=""
    skiplinktext=""
    staticdisplaylevels="2" BorderColor="#999999" BorderStyle="Solid" BorderWidth="0px"
    OnMenuItemClick="btnleft_MenuItemClick" >
            <DynamicMenuItemStyle BorderStyle="None" />
            <StaticMenuItemStyle CssClass="btnon" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" HorizontalPadding="0px" ItemSpacing="0px" />
            <StaticHoverStyle CssClass="btnon" BorderStyle="Solid" BorderColor="#999999" BorderWidth="1px" />
            <StaticSelectedStyle BackColor="White" />
           
        </asp:menu>

 


[Multiview control]

   <asp:MultiView ID="CustMultiView" runat="server" ActiveViewIndex=0>
     
   <asp:View ID="Consumables" runat="server">
   // content......
   
   </asp:View>
     
      
   <asp:View ID="Services" runat="server">
      
   // content......
       </asp:View>
     
     
   <asp:View ID="Training" runat="server">
   // content......
    
   </asp:View>
     
   <asp:View ID="Support" runat="server">
   // content......
     
          </asp:View>

  </asp:MultiView>

Amanda Wang - M
Asp.Net User
Re: trouble linking A menu control using sitemap datasource to MultiView Control?10/10/2007 6:30:35 AM

0/0

Hi,

Base on your description, you want to  change the MultiView's ActiveViewIndex in the menuItem click event, but the menuItenm click  event cannot be fired, right? 

In fact, If the menuitem's navigateURL or URL is not null or empty, when you click on it , the page will be redirect to the new page directly without postback, so the menuitem event be fired.

So, you can try to do like this:

1. Add the menuitems in the aspx file not use the sitemap, because if the sitemapnode's url 's empty, the menuitem is unclickable.

<asp:Menu ID="Menu1" runat="server" OnMenuItemClick="Menu1_MenuItemClick">
                        <Items>
                            <asp:MenuItem  Text="Home"  Value="1">
                            </asp:MenuItem>
                            <asp:MenuItem  Text="About" Value="2">
                            </asp:MenuItem>
                        </Items>
                    </asp:Menu>

 2. Redirect the new page in the codebehind:

 protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
    {
        if (e.Item.Text == "Home")
        {
            MultiView1.ActiveViewIndex = Int32.Parse(e.Item.Value);

            Response.Redirect("~/MenuEvent/CAse/Default.aspx");
        }
    }
  Hope it helps.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
dwilliams459
Asp.Net User
Re: trouble linking A menu control using sitemap datasource to MultiView Control?10/10/2007 3:12:19 PM

0/0

As an alternative, I am doing the following:  You can add a Query string parameter to the target url, then assign the View index on form load.  If your MenuControl is encapsulated in a usercontrol or on a Master page, this should give you the flexibility to move Multiview items to separate pages.  In my case the page I am modifying has grown very large, and I want the ability to break it up. 
Update: I am not currenlty using a sitemap, but a seperate XML file with a 'pagemode' attribute mapped to 'Value'.  I image the 'pagemode' attribute could be added to the existing sitemap, however I am uncertain if it can be mapped.  If not perhaps you can get the XmlElement in the code below. 

    Public Property MenuPageMode() As String
        Get
            Return ViewState("MenuPageMode")
        End Get
        Set(ByVal value As String)
            ViewState("MenuPageMode") = value
        End Set End Property Private Sub mnuLeftNavigation_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles mnuLeftNavigation.Load
        Dim reqPM As String = Request("pagemode")
        If Len(reqPM) > 0 Then MenuPageMode = reqPM Else
            MenuPageMode = 2
        End If
    End Sub

    Private Sub mnuLeftNavigation_MenuItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) _
            Handles mnuLeftNavigation.MenuItemDataBound
        'Dim xePage As XmlElement = CType(e.Item.DataItem, XmlElement) ' Use XmlElement if no Value
        e.Item.NavigateUrl = String.Format("{0}?pagemode={1}", e.Item.NavigateUrl, e.Item.Value) 
        If e.Item.Value = MenuPageMode Then e.Item.Selected = True
    End Sub
  
David Williams MCP
.Net Senior Developer
3 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
trouble linking A menu control using sitemap datasource to ... trouble linking A menu control using sitemap datasource to MultiView Control? Last post 10-10-2007 11:12 AM by dwilliams459. 2 replies. ...
Website Navigation As a result, the pages you create using the MultiView tend to be heavier than normal ..... This part is performed by the SiteMapDataSource control and the ...
TheMSsForum.com >> Asp >> User control problem - The Microsoft ... I am trying to use the menu control for a tabbed menu system but it's frustrating the hell out of me. The full code is listed below. The trouble that I'm ...
.NET ASP Page 30 - Bytes Site Map Menu Control with Multiview Control ? .... acceder al datasource en el evento _ItemDataBound con XML ยท Change of state in reponse to the click event of a ...
Website Navigation One all-purpose solution is the TreeView control. You can add the TreeView and bind it to. the SiteMapDataSource in the master page using the DataSourceID, ...
AJAX Control Toolkit - Source Code Change from TreeView for SiteMapDataSource display to Repeater+HyperLink with ...... This can happen when paging through the MultiView control and switching ...
.NET ASP Page 36 - Bytes Site Map Position sql data source to the combo selected value in asp.net 2. ? file system ... Showing a different .aspx page in each View of a MultiView control ...
TheMSsForum.com >> Asp >> The SiteMapProvider 'MySiteMap' cannot ... Menu control issue.... I am trying to use the menu control for a tabbed menu system but ...... ASP.NET web controls im building a much nicer interface for paging (with page number links, next, previous etc) commands using a repeater control to put on my site [link] right ...
ASP.NET Development NET using VS 2005. When I launched an ASP.NET web site, from Visual Studio or from my browser, ..... NET 2.0 Menu Control Not working in Safari web browser ...




Search This Site:









 
All Times Are GMT