我想在twitter自举导航菜单上面放置一个div,Intro是我要在菜单上方显示的div,必须修复.问题是我在菜单上放置了一个背景图像,但它也显示了Intro div 上的背景图像,我想在Intro div 之后显示背景图像.请帮我解决这个问题.
<div class="navbar navbar-inverse navbar-fixed-top">
<div id="Intro">
This is page is created with bootstrap
</div>
<div class="container">
<div class="navbar-header">
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="home.aspx"> Home</a> </li>
<li><a href="contact.aspx"> Contact</a> </li>
</ul>
</div>
</div>
.navbar-inverse {
background-color : #fffff;
border-color:transparent;
background: #ffffff;
url('bgimg.gif') repeat-x;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Bootstrap网格系统.行之间的间距太大.
我怎样才能减少它?
<div class="row">
<div class="col-md-6">
<h1 id="Heading"> Heading </h1>
<div class="row" style="margin-left:6px;">
<div class="col-md-12">
<div class="row">
<div class="col-md-12">
<div id="rect"> <span id="Heading" style="margin-left:15px;font-weight:bold; font-size: 18pt;color: #2373B3;"> Span </span> </div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="rect"> <span id="Heading" style="margin-left:15px;font-weight:bold; font-size: 18pt;color: #2373B3;"> Span </span> </div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="rect"> <span id="Heading" style="margin-left:15px;font-weight:bold; font-size: 18pt;color: #2373B3;"> Span </span> </div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="rect"> <span id="Heading" style="margin-left:15px;font-weight:bold; font-size: 18pt;color: #2373B3;"> Span </span> …Run Code Online (Sandbox Code Playgroud) 我将图像文件保存在文件夹/ images/profile中,我想将图像路径保存在数据库中,不知道如何在视图中显示图像.我是MVC的新手.以下是图片上传的代码.请帮忙.
HomeController.cs
public class HomeController : Controller
{
ImageEntities db = new ImageEntities();
public ActionResult Index()
{
return View();
}
public ActionResult FileUpload(HttpPostedFileBase file, tbl_Image model)
{
if (file != null)
{
string pic = System.IO.Path.GetFileName(file.FileName);
string path = System.IO.Path.Combine(
Server.MapPath("~/images/profile"), pic);
// file is uploaded
file.SaveAs(path);
}
return View("FileUploaded", db.tbl_Image.ToList());
}
public ActionResult FileUploaded()
{
return View();
}
}
Run Code Online (Sandbox Code Playgroud)
FileUpload.cshtml
@using (Html.BeginForm("FileUpload", "Home", FormMethod.Post,
new { enctype = "multipart/form-data" }))
{
<label for="file">Upload Image:</label>
<input type="file" name="file" id="file" …Run Code Online (Sandbox Code Playgroud) 我正在研究需要查找200英里范围内最近的医院的应用程序。我有一份经度和纬度已保存在数据库中的医院列表,但是我想获取设备位置。我如何获取设备位置。我在下面使用以下代码。
namespace GoogleMaps
{
class Program
{
private double HaversineDistance(double firstLat, double firstLong, double secondLat, double secondLong)
{
double dLat = this.toRadian(secondLat - firstLat);
double dLon = this.toRadian(secondLong - firstLong);
double a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) +
Math.Cos(this.toRadian(firstLat)) * Math.Cos(this.toRadian(secondLat)) *
Math.Sin(dLon / 2) * Math.Sin(dLon / 2);
double c = 2 * Math.Asin(Math.Min(1, Math.Sqrt(a)));
double d = 6371 * 2 * Math.Asin(Math.Min(1, Math.Sqrt(a)));
return d;
}
private double toRadian(double val)
{
return (Math.PI / 180) …Run Code Online (Sandbox Code Playgroud) 我有两个表,其结构如下:
Employee:
int Id
string EmployeeName
string Department
Department:
int Dept_Id
string Department
Run Code Online (Sandbox Code Playgroud)
部门表存储所有部门及其各自的ID,我有一个包含DropDownList的Employee注册表.我想在下拉列表中加载表单时填充所有部门,因为我必须在同一视图上调用两个模型.我在使用元组,但它并没有解决我的问题.请帮忙解决我的问题.我正在使用的代码是:
public ActionResult Index()
{
var model = new model<Employee, Department>(new Employee(), new Department());
return View(model);
}
@model Tuple<MVcEmpApp.Models.Employee, MVcEmpApp.Models.Department>
[HttpPost]
public ActionResult InsertRecord(MyViewModel model)
{
if(ModelState.IsValid)
{
var Employee=new Employee();
Employee.EmployeeName=model.employee.EmployeeName;
Employee.Department=model.employee.Department;
db.AddToEmployee(Employee);
db.SaveChanges();
}
}
Run Code Online (Sandbox Code Playgroud)
请提出任何建议,谢谢你的答案......
我从ASP.net MVC实体框架中的两个表加入后检索数据但是在视图中无法访问属性,当我运行代码时它给出错误:传递到字典中的模型项是'System.Collections.Generic类型.列表1[<>f__AnonymousType16 .....但这个字典.... System.Collections.Generic.IEnumerable`1.谢谢你的回答..
我的代码是:
HomeController的:
dbEntities dbquery = new dbEntities();
public ActionResult Index()
{
var id = 1;
var query = (from x in dbquery.Emp_
join y in dbquery.Departments on x.Id equals y.emp_id
where x.Id == id
select new { x.Id, x.EmployeeName, x.Department, y.emp_id, y.Dept_Id, y.DeptName }).ToList();
return View(query.ToList());
}
Run Code Online (Sandbox Code Playgroud)
在视图中:
@model IEnumerable
@foreach (var item in Model)
{
@item.... (Properties are inaccessible)
}
Run Code Online (Sandbox Code Playgroud)