我是vb中的ASP.NET新手。我使用Visual Studio 2010。
我下载了一个bootstrap并将其转换为.aspx(我将index.html更改为index.aspx)。每当我从工具箱中拖出一个按钮时,我都会收到以下消息:“插入一个asp.net控件会将页面中的HTML转换为ASP.NET表单并删除其当前属性。是否要插入ASP.NET控件?”。
当我点击是按钮时按钮工作但设计确实搞砸了。侧面菜单图标变大了。
我尝试手动编码
中的按钮 <div class="row no-padding">
和按钮的代码
<asp:Button ID="Button1" CssClass="btn-primary" runat="server" Text="Login" />
在那里我有一个按钮,即使它有一个回发网址也不起作用,但设计仍然很好。
我也尝试将其转换为母版页并包含内容占位符,但结果相同。
这是我的整个代码(它不是母版页)。
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Index.aspx.vb" Inherits="Default2" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>INDEX</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/datepicker3.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<!--Icons-->
<script src="js/lumino.glyphs.js"></script>
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<form id="form1" runat="server">
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><span>Lumino</span>Admin</a>
<ul class="user-menu">
<li class="dropdown pull-right">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><svg class="glyph stroked male-user"><use xlink:href="#stroked-male-user"></use></svg><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#"><svg class="glyph stroked male-user"><use xlink:href="#stroked-male-user"></use></svg> Profile</a></li>
<li><a href="#"><svg class="glyph stroked gear"><use xlink:href="#stroked-gear"></use></svg> Settings</a></li>
<li><a href="#"><svg class="glyph stroked cancel"><use xlink:href="#stroked-cancel"></use></svg> Logout</a></li>
</ul>
</li>
</ul>
</div>
</div><!-- /.container-fluid -->
</nav>
<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
<form role="search">
<div class="form-group">
</div>
</form>
<ul class="nav menu">
<li><a href="index.aspx"><svg class="glyph stroked dashboard-dial"><use xlink:href="#stroked-dashboard-dial"></use></svg> Home</a></li>
<li><a href="Employees.aspx"><svg class="glyph stroked calendar"><use xlink:href="#stroked-calendar"></use></svg> Widgets</a></li>
<li><a href="charts.aspx"><svg class="glyph stroked line-graph"><use xlink:href="#stroked-line-graph"></use></svg> Charts</a></li>
<li><a href="tables.aspx"><svg class="glyph stroked table"><use xlink:href="#stroked-table"></use></svg> Tables</a></li>
<li><a href="forms.aspx"><svg class="glyph stroked pencil"><use xlink:href="#stroked-pencil"></use></svg> Forms</a></li>
<li><a href="panels.aspx"><svg class="glyph stroked app-window"><use xlink:href="#stroked-app-window"></use></svg> Alerts & Panels</a></li>
<li><a href="icons.aspx"><svg class="glyph stroked star"><use xlink:href="#stroked-star"></use></svg> Icons</a></li>
<li class="parent ">
<a href="#">
<span data-toggle="collapse" href="#sub-item-1"><svg class="glyph stroked chevron-down"><use xlink:href="#stroked-chevron-down"></use></svg></span> Dropdown
</a>
<ul class="children collapse" id="sub-item-1">
<li>
<a class="" href="#">
<svg class="glyph stroked chevron-right"><use xlink:href="#stroked-chevron-right"></use></svg> Sub Item 1
</a>
</li>
<li>
<a class="" href="#">
<svg class="glyph stroked chevron-right"><use xlink:href="#stroked-chevron-right"></use></svg> Sub Item 2
</a>
</li>
<li>
<a class="" href="#">
<svg class="glyph stroked chevron-right"><use xlink:href="#stroked-chevron-right"></use></svg> Sub Item 3
</a>
</li>
</ul>
</li>
<li role="presentation" class="divider"></li>
<li><a href="login.html"><svg class="glyph stroked male-user"><use xlink:href="#stroked-male-user"></use></svg> Login Page</a></li>
</ul>
</div><!--/.sidebar-->
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
<div class="row">
<ol class="breadcrumb">
<li><a href="#"><svg class="glyph stroked home"><use xlink:href="#stroked-home"></use></svg></a></li>
<li class="active">Icons</li>
</ol>
</div><!--/.row-->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Dashboard</h1>
</div>
</div><!--/.row-->
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-3">
<div class="panel panel-blue panel-widget ">
<div class="row no-padding">
<!--/HERE IS MY BUTTON*--><asp:Button ID="Button1" CssClass="btn-primary" runat="server" Text="Login" PostBackUrl="~/Employees.aspx" />
</div>
</div>
</div>
</div><!--/.col-->
</div><!--/.row-->
</div> <!--/.main-->
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/chart.min.js"></script>
<script src="js/chart-data.js"></script>
<script src="js/easypiechart.js"></script>
<script src="js/easypiechart-data.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script>
$('#calendar').datepicker({
});
!function ($) {
$(document).on("click", "ul.nav li.parent > a > span.icon", function () {
$(this).find('em:first').toggleClass("glyphicon-minus");
});
$(".sidebar span.icon").find('em:first').addClass("glyphicon-plus");
}(window.jQuery);
$(window).on('resize', function () {
if ($(window).width() > 768) $('#sidebar-collapse').collapse('show')
})
$(window).on('resize', function () {
if ($(window).width() <= 767) $('#sidebar-collapse').collapse('hide')
})
</script>
</form>
</body>
</html>
答案 0 :(得分:1)
我认为您在嵌套表单中的问题。你有两个,嵌套
答案 1 :(得分:0)
您的按钮应位于表单元素内,
所有按钮和服务器端控件都应该存在于主表单元素中,这就是asp.net表单的工作方式
在你的代码中,我可以看到按钮在表单之外,因此表单提交正在执行