我的全局忽略模式有以下模式:
*.pdb *.suo *.user *.cache */_ReSharper */bin */obj *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store
Run Code Online (Sandbox Code Playgroud)
例如,resharper文件夹(_ReSharper.SubtextSolution)仍然被提交以及其他一些文件夹,例如bin,由于某种原因.
我也有兴趣看到其他人的全局忽视模式.并不是说每个人都会专门应用于我的环境,但是仍然有助于看到一些......特别是与.NET环境有关的.
我在提交表单后尝试获取自己的viewmodel,我收到以下错误:"无法将'System.String []'类型的对象强制转换为'System.String'"
这是我的代码:
视图模式:
public class SoftwarePackages
{
public string[] PermissionsList { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
ASPX
<%: Html.ListBoxFor(model => model.PermissionsList, new List<SelectListItem>(), new { size = 10 })%>
Run Code Online (Sandbox Code Playgroud)
调节器
[HttpPost]
public ActionResult Index(SoftwarePackages softwarePackages)
{
code...code...code
}
Run Code Online (Sandbox Code Playgroud)
问题是什么?
谢谢
zurdoIL
我想部署我的ASP.NET MVC站点并具有以下脚本.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\MyProjName\MyProjName.csproj"/>
<PropertyGroup>
<NewInstallDir>C:\DeployFolder\</NewInstallDir>
<BinDir>$(NewInstallDir)bin\</BinDir>
</PropertyGroup>
<Target Name="Build">
<MSBuild Projects="..\MySlnName.sln"
Properties="Configuration=Release;Platform=Any CPU;OutputPath=$(BinDir)" />
<Copy SourceFiles="@(Content->'..\MyProjName\%(RelativeDir)%(FileName)%(Extension)')"
DestinationFiles="@(Content->'$(NewInstallDir)%(RelativeDir)%(FileName)%(Extension)')" />
<Copy SourceFiles="@(None->'..\MyProjName\%(RelativeDir)%(FileName)%(Extension)')"
DestinationFiles="@(None->'$(NewInstallDir)%(RelativeDir)%(FileName)%(Extension)')" />
<MakeDir Directories="@(Folder->'$(NewInstallDir)%(RelativeDir)')" />
</Target>
</Project>
Run Code Online (Sandbox Code Playgroud)
大意.
我将二进制文件复制到C:\ DeployFolder(从源代码中获取文件夹的结构).我将我的dll构建到C:\ DeployFolder\Bin(我在sources文件夹中没有这个文件夹所以我需要单独复制它).
我运行我的脚本 - 所有工作而不是复制DLL到OutputPath.相同的脚本适用于其他asp.net mvc项目.我不知道在这种情况下有什么问题.
我用解决方法完成了这个问题,但我想知道这个脚本有什么问题.
我想在页面加载后立即发送表单.表单中的所有变量都是动态编写的,没有用于提交的按钮.
以下JS脚本是否适用于所有浏览器?
<script type='text/javascript'> window.onload = function(){ window.document.forms[0].submit(); }; </script>
Run Code Online (Sandbox Code Playgroud)
我怀疑window.onload会毫无问题地工作.
提前致谢...
我已经编写了一个从范围字段生成输入字段的指令,一切正常,除非父ng表单保持无效,即使指令中的ng-form无效.
这是我如何检查表单的状态:
<ng-form name="parentForm" class="form-horizontal">
<form-field ng-model="input.name" field="fields[0]" ng-change="changed(input.name)"></form-field>
<form-field ng-model="input.age" field="fields[1]"></form-field>
<pre> parent form: valid : {{parentForm.$valid}}</pre>
</ng-form>
Run Code Online (Sandbox Code Playgroud)
以下是链接功能
var linkFunction = function (scope, element, attrs) {
var fieldGetter = $parse(attrs.field);
var field = fieldGetter(scope);
var template = input(field, attrs); //genrate the template
element.replaceWith($compile(template)(scope)); //replace element with templated code
};
Run Code Online (Sandbox Code Playgroud)
我想问题是我需要编译父元素而不是元素本身来使验证工作,但不知道如何做到这一点
element.replaceWith($compile(template)(scope));
Run Code Online (Sandbox Code Playgroud)
我想计算一个月内的周数.
2014年1月的第一周从第一个星期一开始是第6周.所以,1月有4个星期.从第一个星期一开始,2014年3月的第一周是第3周.所以,三月有5个星期.
我想知道一个月内有多少个星期从第一个星期一算起,而不是第一天.
我该怎么做呢?
我有这个代码,但它用于获取特定日期的月份周数.
public int GetWeekNumberOfMonth(DateTime date)
{
date = date.Date;
DateTime firstMonthDay = new DateTime(date.Year, date.Month, 1);
DateTime firstMonthMonday = firstMonthDay.AddDays((DayOfWeek.Monday + 7 - firstMonthDay.DayOfWeek) % 7);
if (firstMonthMonday > date)
{
firstMonthDay = firstMonthDay.AddMonths(-1);
firstMonthMonday = firstMonthDay.AddDays((DayOfWeek.Monday + 7 - firstMonthDay.DayOfWeek) % 7);
}
return (date - firstMonthMonday).Days / 7 + 1;
}
Run Code Online (Sandbox Code Playgroud) 好的,所以我得到了控制器中的动作,代码是:
[HttpPost]
public ActionResult SaveRow(int? id)
{
//some db operations.
return RedirectToAction("Index");
}
Run Code Online (Sandbox Code Playgroud)
并且在视野中我得到了
@Html.ActionLink(Translation.Accept, "SaveRow", new { id = item.New.RecId })
Run Code Online (Sandbox Code Playgroud)
当我点击按钮可以运行此操作而不重定向到时,我收到错误404 url /SaveRow/?也许这个按钮使用错误我是mvc5的新手,所以请耐心等待.
我将Visual Studio更新为15.8,现在尝试使用Task Runner Explorer编译较少的文件时出现以下错误:
Failed to run "C:\Projects\TFS Git Repo\Main\src\Ljmu.Web.UI\Gruntfile.js"...
cmd.exe /c grunt -b "C:\Projects\TFS Git Repo\Main\src\Ljmu.Web.UI" --gruntfile "C:\Projects\TFS Git Repo\Main\src\Ljmu.Web.UI\Gruntfile.js" --tasks "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\ide\extensions\microsoft\web tools\taskrunnerexplorer\Scripts" vs-grunt-task-reader
grunt[10096]: src\node_contextify.cc:631: Assertion `args[1]->IsString()' failed.
1: 00007FF677EB82F5
2: 00007FF677E94156
3: 00007FF677E94221
4: 00007FF677E6A69A
5: 00007FF6784B5EB2
6: 00007FF6784B7008
7: 00007FF6784B636D
8: 00007FF6784B628B
9: 00000292D50841C1
Run Code Online (Sandbox Code Playgroud)
任何想法欢迎...
编辑
从命令行运行时,它工作正常,所以我认为这只是Task Runner Explorer的问题。
我真的很肛门,想按字母顺序/按类型对我的类属性进行排序。
是否可以使用 VS 中预先存在的功能或可以执行此操作的宏?
例如:
public string foo {get; set;}
public string bar {get; set;}
public int fong {get; set;}
public string loo {get; set;}
Run Code Online (Sandbox Code Playgroud)
至(如果您想按字母顺序排序)
public string bar {get; set;}
public int fong {get; set;}
public string foo {get; set;}
public string loo {get; set;}
Run Code Online (Sandbox Code Playgroud)
或(如果您想按类型排序,然后按字母顺序排序)
public string bar {get; set;}
public string foo {get; set;}
public string loo {get; set;}
public int fong {get; set;}
Run Code Online (Sandbox Code Playgroud)
非常感谢!
请有人把我从我的痛苦中解脱出来......我每小时都在倾诉......
我(这是缩写)创建了一个函数,使用append将页面添加到页面.问题是一旦添加了fadeIn函数就不起作用了. 但是,如果我将元素硬编码到页面,它将工作:
这是我的javascript:
//Loop through the images and print them to the page
for (var i=0; i < totalBoxes; i++){
//$("p").add(arr).appendTo('#bg');
$.ajax({
url: "random.php?no=",
cache: false,
success: function(html){
$(html).fadeIn(html).appendTo('#bg');
}
});
}
//Choose the image to be faded in
$(".pf-box img").hover(function(){
var largePath = $(this).attr("rel");
$(this).fadeOut("slow", function() {
$(this).attr({ src: largePath }).fadeIn("slow");
});
return false;
});
Run Code Online (Sandbox Code Playgroud)
random.php字面上印刷了很多盒子......这里是一个打印样本:
<div class="pf-box" style="">
<a href="#">
This is where the image is printed with the rel attribute on the image tag. (stackoverflow didnt …Run Code Online (Sandbox Code Playgroud) c# ×3
.net ×2
asp.net ×2
ajax ×1
angularjs ×1
append ×1
asp.net-mvc ×1
deployment ×1
fadein ×1
gruntjs ×1
html ×1
javascript ×1
jquery ×1
msbuild ×1
svn ×1
tortoisesvn ×1