1
首先,我是一個asp新手,所以可能是問題太愚蠢,但我仍然無法將下拉列表添加到我的網頁後使用materialize.css。沒有它下拉工作正常,但鏈接文件的物化它不工作。我已經嘗試添加下拉列表從工具箱以及屬於物化,但它沒有得到顯示,雖然代碼是如何解決這個問題?
這是從工具箱 `無法添加在asp.net web窗體中的下拉列表materialize.css
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href="font/material-design-icons/material.css" rel="stylesheet" type="text/css" />
<link href="styles/materialize.min.css" rel="stylesheet" type="text/css" />
<title></title>
<style>
.wraped {
margin-top:10px;
margin-left:20px;
margin-right:20px;
}
</style>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<div class="wraped">
<div class="container" style="width:80%">
<form id="form1" runat="server">
<div class="row">
<!--Navbar-->
<div class="col s4">
<asp:Image ID="logo" CssClass="z-depth-3 responsive-img" ImageUrl="~/images/logo.png" runat="server" Height="122px" Width="214px" />
</div>
<div class="col s6 offset-s2" style="border-bottom:solid 4px #669900;margin-top:25px;" >
<asp:Menu ID="Menu1" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" runat="server" StaticMenuStyle-HorizontalPadding="10px" Width="100%">
<StaticHoverStyle BackColor="#003300" ForeColor="White" />
<StaticMenuItemStyle Font-Names="Corbel" Font-Size="Large" ForeColor="#CC3300" HorizontalPadding="23px" Font-Bold="True" />
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />
</div>
<!--Content-->
<div class="col s12" style="margin-top:20px;">
<asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList><!--Here is the drop down-->
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</form>
</div>
</div>
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>
</body>
</html>
` 添加下拉我的母版頁的代碼段,這是代碼片段與下拉列表兌現
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href="font/material-design-icons/material.css" rel="stylesheet" type="text/css" />
<link href="styles/materialize.min.css" rel="stylesheet" type="text/css" />
<title></title>
<style>
.wraped {
margin-top:10px;
margin-left:20px;
margin-right:20px;
}
</style>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<div class="wraped">
<div class="container" style="width:80%">
<form id="form1" runat="server">
<div class="row">
<!--Navbar-->
<div class="col s4">
<asp:Image ID="logo" CssClass="z-depth-3 responsive-img" ImageUrl="~/images/logo.png" runat="server" Height="122px" Width="214px" />
</div>
<div class="col s6 offset-s2" style="border-bottom:solid 4px #669900;margin-top:25px;" >
<asp:Menu ID="Menu1" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" runat="server" StaticMenuStyle-HorizontalPadding="10px" Width="100%">
<StaticHoverStyle BackColor="#003300" ForeColor="White" />
<StaticMenuItemStyle Font-Names="Corbel" Font-Size="Large" ForeColor="#CC3300" HorizontalPadding="23px" Font-Bold="True" />
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />
</div>
<!--Content-->
<div class="col s12" style="margin-top:20px;">
<div class="input-field">
<select>
<option value="" >Choose your option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
</div><!--Here is the drop down-->
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</form>
</div>
</div>
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>
</body>
</html>
我使用Visual Studio 12
檢查此答案:http://stackoverflow.com/questions/38170589/select-option-does-not-work-in-rails-using-materializecss/38175041#38175041。我相信你的問題是一樣的。 –
問題是下拉列表沒有顯示出來! ,該空間顯示完全空白..而在檢查元素它顯示的代碼...我也使用jquery初始化,但它仍然是相同的 – Sourajit