我有一个VS2012 MVC4解决方案,我测试Web API控制器.
我成功测试了GET,POST,PUT但DELETE仍然给我一个http 404错误.当我在api控制器中的'DeleteMovie'动作中设置断点时,永远不会到达断点.
我读了很多关于这个问题的帖子,但没有人帮助过我.
这是我的DELETE API控制器:
[HttpDelete]
public HttpResponseMessage DeleteMovie(int id)
{
// Delete the movie from the database
// Return status code
return new HttpResponseMessage(HttpStatusCode.NoContent);
}
Run Code Online (Sandbox Code Playgroud)
这是我的html页面:
<script type="text/javascript">
deleteMovie(1, function ()
{
alert("Movie deleted!");
});
function deleteMovie(id, callback) {
$.ajax({
url: "/api/Movie",
data: JSON.stringify({ id: id }),
type: "DELETE",
contentType: "application/json;charset=utf-8",
statusCode: {
204: function () {
callback();
}
}
});
}
</script>
Run Code Online (Sandbox Code Playgroud)
我的经典路线如下:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}", …
Run Code Online (Sandbox Code Playgroud) c# asp.net asp.net-mvc asp.net-web-api asp.net-web-api-routing
我在我的MVC解决方案中创建了一个名为"Admin"的区域.在这个区域,我创建了一个名为"Content"的文件夹来存储我的css文件.
我尝试从视图(cshtml)中引用我的css文件(MaterialPacking.css),如下所示:
<link href="@Url.Content("~/Areas/Admin/Content/MaterialPacking.css")" rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)
这是好方法吗?
谢谢.
使用flow.js组件,我们可以分配一个这样的浏览按钮:
flow.assignBrowse(document.getElementById('browseButton'));
Run Code Online (Sandbox Code Playgroud)
我们可以像这样指定一个放置区域:
flow.assignDrop(document.getElementById('dropTarget'));
Run Code Online (Sandbox Code Playgroud)
我们也可以取消分配这样的放置区域:
flow.unAssignDrop(document.getElementById('dropTarget'));
Run Code Online (Sandbox Code Playgroud)
我的第一个问题是如何取消分配浏览按钮?
我的第二个问题是如何知道(原生)是否已经定义了浏览按钮?
我在文档中看不到任何相关信息.
谢谢.
我使用jQuery mobile创建了我的网站,我想建立相同的底部工具栏,如下图所示.有人能指出我正确的方向吗?
jQuery mobile提供的默认导航栏没有提供相同的外观.
以下是jQuery移动导航栏:http://jquerymobile.com/test/#/test/docs/toolbars/docs-navbar.html
有必要时,文本溢出,每行末尾都有一个包含3个点'...'的表格.我使用了text-overflow属性的省略号值.它的工作原理是:当调整窗口大小时,会显示'...',但是当我表中的行包含一个span时,我有2个问题:
请参阅此处的演示:http://jsfiddle.net/Ah4DR/1/
也许这是一个新手问题,但我搜索了一段时间,没有找到任何解决方案.
我忘了说这不适用于Internet Explorer,但在Chrome上运行正常.
谢谢!
我使用Durandal模板处理asp.net解决方案.
我尝试使用与knockout兼容的koGrid(https://github.com/Knockout-Contrib/KoGrid).在Durandal管理的测试页中插入此网格时,它不起作用:网格似乎在那里但没有正确显示.
我们注意到,如果我们调整窗口大小,则网格会正确调整.
有没有人已经成功将这个koGrid集成到Durandal/HotTowel模板中?
重现问题的步骤:
这是一个包含一个ASP.NET MVC项目的zip来重现这个问题:https://www.dropbox.com/s/15rphyhkqp1h8py/KOGrid-HotTowelTemplate.zip
谢谢你的帮助.
这是一个模型:
Public class Person
{
[Key]
Public int PersonId { get; set: }
Public int Age { get; set; }
Public ColorEnum FavoriteColor { get; set; }
}
Public Enum ColorEnum
{
Red = 1,
Green = 2,
Blue = 3
}
Run Code Online (Sandbox Code Playgroud)
Entity Framework Code First是否可以使用Person模型生成相应的表?ColorEnum类型怎么样?
谢谢
是否可以使用Ajax.ActionLink(...,...)刷新整个页面而不是UpdatetargetID?
我更喜欢使用Ajax.ActionLink,因为经典的Html.ActionLink不是POST方法.
我尝试:
@Ajax.ActionLink("Click me", "MyAction", "MyController", new { value = '1234' }, new AjaxOptions { HttpMethod = "POST", Confirm = "Are you sure ?" }, null)
Run Code Online (Sandbox Code Playgroud)
但页面没有刷新,我不得不按F5.
谢谢.
我使用Entity Framework Code First.
这时我有以下型号:
public class MaterialEditNewViewModel
{
public int RequestID { get; set; }
[Required]
public double? Quantity { get; set; }
[Required]
public MaterialWorthEnumViewModel? MaterialWorth { get; set; }
...
}
Run Code Online (Sandbox Code Playgroud)
MaterialWorthEnumViewModel的位置是:
public enum MaterialWorthEnumViewModel
{
[Display(Name = "< 1.000€")] LessThan1000,
[Display(Name = "1.000€ < 10.000€")] Between1000And10000,
[Display(Name = "10.000€ < 100.000€")] Between10000And100000,
[Display(Name = "100.000€ < 1.000.000€")] Between100000And1000000,
[Display(Name = "1.000.000€ < 10.000.000€")] Between1000000And10000000,
[Display(Name = "10.000.000€ < 25.000.000€")] Between10000000And25000000,
[Display(Name = "> 25.000.000€")] GreaterThan25000000
} …
Run Code Online (Sandbox Code Playgroud) 我使用jQuery文件上传插件(http://blueimp.github.io/jQuery-File-Upload/)来管理我的文件上传.它工作得很好.
我可以检测每个文件的上传时间(例如)是否显示消息.
但我想检测何时上传每个文件以显示最终消息.
怎么办这样的事情?
以下是我的实际实施:
$('#fileupload').fileupload({
url: "api/fileManager",
dataType: 'json',
maxFileSize: 100000000, // 100 MB for testing!
dropZone: $(document.body)
}).on('fileuploadchange', function (e, data) {
// nothing here
}).on('fileuploaddrop', function (e, data) {
// nothing here
}).on('fileuploadsend', function (e, data) {
// displaying the loading & progress bar
$('#loading').show().html('<small><b>' + rscTransport.loading + '</b></small>');
$('#progress').show();
}).on('fileuploaddone', function (e, data) {
// here this is called for each individual file
if (typeof data.result != 'undefined') {
ctxTransport.getDocumentsByType(data.result.typeId, documents);
log('Fichier chargé avec …
Run Code Online (Sandbox Code Playgroud) asp.net-mvc ×4
javascript ×2
asp.net ×1
c# ×1
css ×1
css3 ×1
durandal ×1
flow-js ×1
hottowel ×1
html ×1
jquery ×1
knockout.js ×1
kogrid ×1