
MVC
文章平均质量分 62
jameszhouhvs
WinForm > ASP.NET > MVC > Silverlight > WP > Xamarin > .NET Core > .NET
展开
-
MVC - Pass array from model to JS
var yourJavaScriptArray = @Html.Raw(Json.Encode(Model.YourDotNetArray));LINK - http://stackoverflow.com/questions/3850958/pass-array-from-mvc-to-javascript原创 2015-10-18 01:22:24 · 1221 阅读 · 0 评论 -
MVC - File download action
http://stackoverflow.com/questions/5826649/returning-a-file-to-view-download-in-asp-net-mvcpublic ActionResult Download(){ var document = ... var cd = new System.Net.Mime.ContentDisposition原创 2015-10-18 07:33:34 · 1062 阅读 · 0 评论 -
asp.net MVC: PagedList + View Model
To pass view model with PagedList:1. Controller action must use HttpGet and use View Model as action parameterpublic ActionResult Index(UserIndexModel model)2. In the action return the view model with原创 2015-11-10 19:18:07 · 2286 阅读 · 0 评论 -
ASP.NET MVC - Display UTC time from server as local time on client side
View html:span class="utcdatetime">@user.MostRecentTestDate.Value.ToString("M/dd/yyyy hh:mm tt UTC")span>View js:(needs reference to jquery.formatDateTime.js from https://github.com/agschwender/jquery原创 2015-11-11 21:01:59 · 1754 阅读 · 0 评论 -
ASP.NET MVC - loop model data in javascript
Key: razor syntax using @: before the js variable in c# code blockExample: var chartData = []; @for(int i=0; i < Model.ModuleDetails.Count; i++) { @: chartData.push(@Html.原创 2015-11-20 20:23:22 · 1751 阅读 · 0 评论 -
Bootstrap 3 + MVC 5 - validation css tips
1. the default MVC 5 site.css is missing some style for validation style on form-control. problem resolved after adding the missing css to site.css/* styles for validation helpers */.field-validation-原创 2015-12-06 07:22:40 · 2544 阅读 · 0 评论