目前我在同一行上有一个段落标题和右侧的图像:
<div class="paragraphs">
<div class="row">
<div class="span4">
<div class="content-heading"><h3>Experience   </h3><img src="../site/img/success32.png"/></div>
<p>Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.</p>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这很好 - 内容标题和图像在同一行.但是,当我将图像放在内容标题div之前时,它们不再在同一行上.这就是我想要达到的目标 - 图像然后内容标题 - 在同一条线上.
我正在使用Bootstrap开发一个站点,它有28个模态窗口,其中包含不同产品的信息.我希望能够在开放模式窗口中打印信息.每个窗口都有一个id.
<!-- firecell panel & radio hub -->
<div class="modal hide fade" id="fcpanelhub">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">X</button>
<h3>5000 Control Panel & Radio Hub</h3>
</div>
<div class="modal-body">
<img src="../site/img/firecell/firecell-panel-info-1.png" alt=""/><hr/>
<img src="../site/img/firecell/firecell-panel-info-2.png" alt=""/><hr/>
<img src="../site/img/firecell/firecell-radio-hub-info-1.png" alt=""/><hr/>
<img src="../site/img/firecell/firecell-radio-hub-info-2.png" alt=""/>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Close</a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
因此,如果我在modal-footer- 'print'中添加一个新按钮,并且单击它我想要打印该模态.我会说javascript会被使用吗?如果是这样,我如何告诉javascript只打印开放模式,而不是其他模式?
所有帮助赞赏.
我正在构建一个配置文件页面,其中包含许多与特定模型(租户)相关的部分 - AboutMe,MyPreferences - 这些事情.这些部分中的每一部分都将是部分视图,以允许使用AJAX进行部分页面更新.
当我点击ActionResultTenantController中的一个时,我能够创建一个强类型视图,并将模型数据传递给视图.部分观点无法实现这一点.
我创建了一个局部视图_TenantDetailsPartial:
@model LetLord.Models.Tenant
<div class="row-fluid">
@Html.LabelFor(x => x.UserName) // this displays UserName when not in IF
@Html.DisplayFor(x => x.UserName) // this displays nothing
</div>
Run Code Online (Sandbox Code Playgroud)
然后我有一个视图MyProfile,将呈现提到的部分视图:
@model LetLord.Models.Tenant
<div class="row-fluid">
<div class="span4 well-border">
@Html.Partial("~/Views/Tenants/_TenantDetailsPartial.cshtml",
new ViewDataDictionary<LetLord.Models.Tenant>())
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
如果我将代码包装在DIV _TenantDetailsPartial里面@if(model != null){},那么页面上就不会显示任何内容,所以我猜测有一个空模型被传递给视图.
为什么我ActionResult在'session'中创建一个来自用户的强类型视图会被传递给视图?如何将'session'中的用户传递给不是从ActionResult?创建的局部视图?如果我遗漏了这个概念,请解释一下.
我刚刚结束了一个大学项目,我不确定我是否一直盯着我的电脑太长时间并且遗漏了一些显而易见的东西,但是当我尝试将用户注销时,我得到了404而不是找到URL /帐户/ LogOff.
我有一个导航栏,显示登录/注销,具体取决于用户是,登录还是注销:
<div class="nav-collapse collapse">
<ul class="nav pull-right">
<li class="dropdown" id="dropdown-login-div">
@if (!Request.IsAuthenticated)
{
<a class="dropdown-toggle" href="#" data-toggle="dropdown">Sign In <strong class="caret"></strong></a>
}
else
{
@Html.ActionLink("Log Off", "LogOff", "Account")
}
<div class="dropdown-menu" id="dropdown-login">
@Html.Partial("~/Views/Account/_LoginPartial.cshtml", new ViewDataDictionary<LetLord.Models.LoginModel>())
</div>
</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
在我的帐户控制器中,Internet模板附带的默认LogOff操作:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LogOff()
{
WebSecurity.Logout();
return View("Index");
}
Run Code Online (Sandbox Code Playgroud)
有人能告诉我为什么会发生这种情况 - 在我将笔记本电脑靠在墙上之前.干杯.
使用.NET Web API(.NET 4,EF 4),我在调试时遇到一些奇怪的错误,实际上无法弄清楚发生了什么.
在DocumentRepository我有这个构造函数说:
public DocumentRepository(DocPortalContext db)
{
this._db = db;
}
Run Code Online (Sandbox Code Playgroud)
如果我调试并将鼠标悬停_db在弹出窗口中的项目中,我遇到以下错误:
System.Data.Entity.Infrastructure.IObjectContextAdapter.ObjectContext ='System.Data.Entity.DbContext'不包含'System'的定义,也没有扩展方法'System'接受类型'System.Data.Entity的第一个参数.可以找到DbContext'(您是否缺少using指令或程序集引用?)
和
System.Collections.Generic.ICollection> .IsReadOnly ='System.Collections.Generic.Dictionary'不包含'System'的定义,也没有扩展方法'System'接受类型'System.Collections.Generic.Dictionary的第一个参数
没有例外被捕获.
如果我在存储库方法中在此行上设置了一个断点return _db.Documents.AsQueryable();- 并将鼠标悬停在上面,Document我会收到以下错误:
System.Linq.IQueryable.Provider ='System.Data.Entity.Infrastructure.DbQuery'不包含'System'的定义,也没有扩展方法'System'接受类型'System.Data.Entity.Infrastructure的第一个参数. DbQuery'可能是...
一些帮助将非常感激.
附加信息:
_db按以下方式钻取会在最后引用消息:
base(System.Data.Entity.DbContext) - >内部上下文 - > _appConfig - >最后默认连接工厂旁边有以下错误"评估的函数需要运行所有线程."
根据我的评论提供更多信息:
这与问题没有关系,但是我认为我安装.NET或VS可能有问题 - 我不太了解管道调用,也许你们其中一个可以.无论如何,我可以浏览到我的WebAPI项目中的URI并在浏览器中返回JSON.当我尝试在我的网站项目中使用URI时,我在浏览器中得到了这个:Could not find file 'C:\Program Files (x86)\IIS Express\System.Net.Http.StreamContent'.这也是一个例外.
c# asp.net-mvc entity-framework asp.net-mvc-4 asp.net-web-api
当我点击一个时,我收到500内部服务器错误Ajax.ActionLink.我有一个由多个部分组成的个人资料页面.每个部分都对服务器进行Ajax调用,以允许编辑与该特定部分相关的用户信息.
我已经实现了3个部分功能,并且功能正常.我现在正在处理的那个应该首先显示上传图像的列表 - 如果用户没有上传任何图像,Ajax.ActionLink则将显示之前提到的图像,当点击该图像时将使用户部分地促进图像上载.
这是我点击链接时在Chrome中看到的内容:

这是GET和POST ActionResults:
//
// GET: /Tenants/TenantUploadReference
[HttpGet]
public ActionResult TenantUploadReference()
{
try
{
var currentTenant = tenantRepository.GetLoggedInTenant();
if (currentTenant.ReferencePhotos == null)
{
currentTenant.ReferencePhotos = currentTenant.ReferencePhotos ?? new List<ReferencePhoto>();
}
return PartialView("_TenantUploadReferencePartial", currentTenant.ReferencePhotos.ToList());
}
catch (Exception e)
{
ModelState.AddModelError("", e);
return View();
}
}
//
// POST: /Tenants/TenantUploadReference
[HttpPost]
public ActionResult TenantUploadReference(HttpPostedFileBase file, Tenant tenant)
{
try
{
if (file != null)
{
if (file.ContentLength > 10240)
{
ModelState.AddModelError("file", "The size …Run Code Online (Sandbox Code Playgroud) 我有一个传递给视图的对象的通用列表.目前,每个列表项都逐行显示给用户:
@foreach (var result in Model.SearchResults)
{
result.Address.TownCity
// ...
}
Run Code Online (Sandbox Code Playgroud)
因此每个列表项都显示在自己的行中.在美学上,这看起来并不是最好的,因为剩下相当多的空白区域.
我想做的是这样的:
第1行| 列表项1 | 清单项目2
第2行| 清单项目3 | 清单项目4
等等.....
这是我必须做的事情服务器端,即将我的列表的一半放入另一个列表,并在视图中有两个foreach循环 - 每一个填充一列,逐行?或者无论如何这可以在使用剃须刀的视图中完成?
我正在使用第三方软件从html文档渲染PDF.我创建了一个小型测试项目,并使用我能够从目录中读取html文档的OnClick事件<asp:Button>并将其呈现为PDF而没有任何问题.
响应创建如下:
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");
HttpContext.Current.Response.AddHeader("Content-Disposition",
String.Format("{0}; filename=Test.pdf;", "inline" ));
HttpContext.Current.Response.BinaryWrite(pdfBuffer);
HttpContext.Current.ApplicationInstance.CompleteRequest();
Run Code Online (Sandbox Code Playgroud)
当我查看Chrome中的响应时,我可以看到正确设置了Content-Type:
内容处置:内联; 文件名= HtmlToPdf.pdf;
内容长度:101482
内容类型:应用程序/ PDF
我试图将上述内容转移到我当前的项目中.唯一的区别是,<asp:Button>我在DevExpress网格视图中使用自定义按钮而不是一个.我最初在回调面板中处理了自定义按钮单击,但未设置Content-Type.在Chrome中查看响应证明了这一点:
内容处置:内联; 文件名= 5.pdf;
内容编码:gzip
内容长度:149015
内容类型:text/plain的; 字符集= utf-8的
我也尝试过使用该gvDocuments.CustomButtonCallback += new ASPxGridViewCustomButtonCallbackEventHandler(gvDocuments_CustomButtonCallback);事件,但仍没有设置Content-Type.
任何人都有任何想法,为什么我不能在上述场景中设置Content-Type?
我有一个消耗Web API操作的异步方法.它似乎陷入了一个循环.我的理由是因为如果我在catch块的第1行放置一个断点,并且进入,它实际上从未击中第二行.
我最初返回一个包含100,000+(~30mb)行的数据集,并认为由于请求的大小,它可能会很慢,但在更改我的Web API操作以仅返回1行后问题仍然存在.当我浏览到Web API解决方案的URI时,肯定会返回数据,我在浏览器中返回了JSON.
public async Task<IEnumerable<Document>> GetAll()
{
try
{
var response = await _client.GetAsync(
string.Format("{0}/api/document", _baseURI));
// never hits line below
return await response.Content.ReadAsAsync<Document>()
as IEnumerable<Document>;
}
catch (Exception ex)
{
// handle exception
}
}
Run Code Online (Sandbox Code Playgroud)
我不确定我在这里遗失了什么?一些帮助将不胜感激.
编辑1
在回答一些问题时,我有一个由MVC项目引用的Web API项目.我必须对JSON反序列化的原始问题进行一些更改.
库:
public async Task<IEnumerable<Document>> GetAll()
{
try
{
string json;
var response = await _client.GetAsync(string.Format(
"{0}/api/document", _baseURI)).ConfigureAwait(false);
var resource = await response.Content.ReadAsAsync<Document>();
using(var reader = new StreamReader(resource.ToString()))
{
json = reader.ReadToEndAsync().ToString();
}
return JsonConvert.DeserializeObjectAsync<Document>(json)
as IEnumerable<Document>;
} …Run Code Online (Sandbox Code Playgroud) 我有两个清单,imported和existing.它们可以具有相同的长度或不同的长度.
我想检查是否有任何imported不在的东西existing.
如果它们的长度相同,我可以比较它们并发现与以下内容不匹配:
if(Enumerable.SequenceEqual(imported.OrderBy(i => i), existing.OrderBy(ex => ex)) == false)
Run Code Online (Sandbox Code Playgroud)
如果列表长度相同,则上述工作正常.如果没有,它不会包含另一个不包含的项目,这是有道理的.
如何为不同长度的列表执行此操作?
情景A,应该通过,没有什么imported不在existing:
现有: "One", "Two", "Three"
进口: "One","Two"
情景B,应该失败,"两个"在,imported但它不在existing:
现有: "One", "Two", "Three"
进口: "One","Tow"
我用Intersect,Except和Any,但他们将努力在方案A,而不是B,反之亦然.
c# ×8
asp.net-mvc ×5
asp.net ×1
async-await ×1
asynchronous ×1
css ×1
html ×1
httpresponse ×1
image ×1
javascript ×1
jquery ×1
linq ×1
modal-dialog ×1
model ×1
pdf ×1
printing ×1
razor ×1
string ×1
webforms ×1