problems with nav navbar-nav and dropdown-toggle

2

How about, Develop an application in VS 2013 and add a bootstrap template to my master page, the same code and the same template I did to develop a project in VS 2010 but it turns out that the nav navbar-nav pulldown menu does not work using the data-toggle="dropdown", in addition to this I had to comment on these lines that I think are the ones I need to include to the master page, comment them because VS 2010 gives error, but in VS 2013 no.

<%--<asp:ScriptReference Name="MsAjaxBundle" />
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="bootstrap" />
            <asp:ScriptReference Name="respond" />--%>

master page code

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="WebApplication.SiteMaster" %>

    <%@ Register Assembly="DevExpress.Web.v14.2, Version=14.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %>
    <%--<%@ Import Namespace="WebApplication.App_Code.Controladores" %>--%>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html>

<html lang="en">
<head id="Head1" runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%: Page.Title %> - My ASP.NET Application</title>
<link rel="Shortcut Icon" href="images/favicon.ico" />
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="css/custom.css" rel="stylesheet" type="text/css" />
<link rel="Shortcut Icon" href="images/favicon.ico" />
<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic"  rel="stylesheet" type="text/css" />
<script type="text/javascript" src="~/Scripts/jquery-1.10.2.js"></script>
<script type="text/javascript" src="~/Scripts/bootstrap.js"></script>
<script type="text/javascript" src="~/Scripts/bootstrap.min.js"></script>
</head>
<body style="background-image:url(Images/fondo.jpg); background-repeat: no-repeat; background-position: center; background-attachment: fixed";  >
<form id="Form1" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server">

        <Scripts>
            <%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
            <%--Framework Scripts--%>
            <%--<asp:ScriptReference Name="MsAjaxBundle" />
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="bootstrap" />
            <asp:ScriptReference Name="respond" />--%>
            <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
            <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
            <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
            <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
            <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
            <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
            <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
            <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
            <%--<asp:ScriptReference Name="WebFormsBundle" />--%>
            <%--Site Scripts--%>
        </Scripts>
    </asp:ScriptManager>
    <div  class="container">
            <div id="logo" >
                <img id="Img1" runat="server" src="Images/logo.png" alt="Freshdesign" />
            </div>
    </div>
    <nav class="navbar navbar-default" role="navigation" >
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

            </div>
            <div class="collapse navbar-collapse">
                <%
                    //string dominio = System.Configuration.ConfigurationManager.AppSettings["dominio"].ToString();
                %>
                <ul class="nav navbar-nav">
                   <%--<li class="active"><a href="<%=dominio%>">Inicio</a></li>--%>
                    <li ><a id="A1" href="~/" runat="server">Incio</a></li>
                    <li > <a href="Pedido_Emergente/Pedido_Emergente.aspx" id="A2" runat="server"> Pedido Emergente</a></li>
                     <li id="Li1" class="dropdown" runat="server">
                        <a href="" runat="server"  class="dropdown-toggle" data-toggle="dropdown"  id="PedidoEmergente">Pedidos<b class="caret"></b></a>
                        <ul id="Ul1" class="dropdown-menu" runat="server">
                        <li> 
                            <a href="Pedido_Emergente/Pedido_Emergente.aspx" id="Pedido"> Pedido Emergente</a>
                        </li>
                        </ul>
                     </li>




                </ul>
                <asp:LoginView ID="LoginView1" runat="server" ViewStateMode="Disabled">
                    <AnonymousTemplate>
                        <ul class="nav navbar-nav navbar-right">                                
                            <li><a id="A3" runat="server" href="~/Account/Login">Log in</a></li>
                        </ul>
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        <ul class="nav navbar-nav navbar-right">
                            <li><a id="A4" runat="server" href="~/Account/ChangeKey" title="Cambiio de clave">Conectado, <%="" %> !</a></li>
                            <li>
                                <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="Redirect" LogoutText="Salir" LogoutPageUrl="~/" OnLoggingOut="Unnamed_LoggingOut" />
                            </li>
                        </ul>
                    </LoggedInTemplate>
                </asp:LoginView>
            </div>
        </div>
    </nav>


    <div class="container body-content">
        <asp:ContentPlaceHolder ID="MainContent" runat="server">
        </asp:ContentPlaceHolder>
        <hr />

        <footer>

                    <asp:UpdatePanel ID="updtePnlMensajes" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnlMensajes" runat="server" Height="60px" HorizontalAlign="Center"
                Width="99%" BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"
                ScrollBars="auto">
                <table>
                    <tr>
                        <td>
                            <asp:UpdateProgress ID="upgPrincipal" runat="server">
                                <ProgressTemplate>
                                    Procesando...&nbsp;
                                    <asp:Image ID="imgProgreso" runat="server" ImageUrl="~/Images/working.gif" />
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%--<asp:Label ID="lblMensaje" runat="server" Font-Bold="True" ForeColor="Red" />--%>
                            <div style=" width: 100%; text-align: center;">
                             <asp:Label ID="lblMsjError" runat="server"  Font-Bold="True" ForeColor="Red"  ></asp:Label>
                            </div>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <cc1:AlwaysVisibleControlExtender ID="avceMensajes" runat="server" TargetControlID="pnlMensajes" 
                HorizontalSide="Center" VerticalSide="Bottom" />

        </ContentTemplate>
    </asp:UpdatePanel>





            <p>&copy; <%: DateTime.Now.Year %> -  ASP.NET Application</p>
        </footer>
    </div>
</form>

    
asked by Jose Felix 09.03.2016 в 16:41
source

1 answer

1

I would advise you to remove the ScriptReference from the code as being

<asp:ScriptReference Name="jquery" />

And replace them with the script tag using ResolveClientUrl()

<script type="text/javascript" src="<%= ResolveClientUrl("~/Scripts/jquery-1.10.2.js") %>></script>

in this way you will solve the url in a relative way to the page that makes use of the master

Here

[ASP.NET] Master Page - Reference relating to elements of the page

I explain on the subject

    
answered by 09.03.2016 в 23:17