Geeks With Blogs

News Please visit me at my new blog!!

profile for Aligned at Stack Overflow, Q&A for professional and enthusiast programmers
"free in Christ Jesus from the law of sin and death." Romans 8:2 (ESV) Check out the Falling Plates video on YouTube.
more about the Gospel
And then listen to Francis Chan speaking at LifeLight in SD.

Donate Bitcoins

Programming and Learning from SD May 2013 Entries
MVC Performance Tip
MVC can work with .cshtml or .aspx pages (you can mix Web Forms and Razor views in the One ASP.Net that Scott Hanselman talks about). This means MVC will search for a view with endings of .aspx, .ascx, .cshtml, .vbcshtml, in the Controller directory (if you have a HomeController, then it it would look in Views/Home, then Views/Shared). If you aren’t using aspx pages it’s doing extra work it doesn’t need to do. See Dave Ward’s post on the importance of using debug=false and Marcin Doboz’s post on ......

Posted On Friday, May 31, 2013 8:10 AM

Pre-Compiling your MVC Views
One part of MVC Views that can cause problems is that the cshtml can cause run-time errors. This can lead to bugs in Production or found by QA that could be avoided if it was built when you build the project. Pre-compiling can be turned on to avoid those problems. You add this in the project file of your web application, by setting the <MvCBuildViews>true&l... in the .csproj. See for more details. Another reason to pre-compile ......

Posted On Tuesday, May 28, 2013 12:28 PM

Uncaught SyntaxError: Unexpected token u. file JavaScript Error in MVC
I was getting a JavaScript error that pointed to line number 1 of my MVC page. I have a form on the page and expected the Unobtrusive Validation to work with the Data Annotations. It took me a while to realize the validation messages weren't showing. After I while I found that I was missing the @Html.ValidationMessageFor(m => m.Name). Adding that for each field fixed it. My password reset with token example. I was missing line 12 and 17. 1: @using (Html.BeginForm("PasswordRe... "Home")) 2: { ......

Posted On Monday, May 20, 2013 1:45 PM

Use the NotMapped Attribute with Entity Framework in Partial Classes
I wanted to add a property to send to my JavaScript class through WebApi, but didn’t want it in the database. I was getting an error telling me I had an invalid name on the EF 5 selection from the database. Adding the NotMapped attribute to the property did the trick. I get it on the JavaScript side as well. I found the answer (again) on StackOverflow. Example: public partial class ComponentAttribute { [NotMapped] public bool IsModified { get; set; } } ......

Posted On Wednesday, May 15, 2013 4:32 PM

jQuery 1.9.1+ Ajax Post is Failing even though it has a 200 Status
I’m using my DataService and AjaxService for JavaScript and upgraded to jQuery 1.9.1. One of my post methods, which was working before, started hitting the deferred fail, instead of the deferred’s done, even though the status code was 200. This method is not returning any JSON to the caller. The 1.9 upgrade guide states “Prior to 1.9, an ajax call that expected a return data type of JSON or JSONP would consider a return value of an empty string to be a success case, but return a null to the success ......

Posted On Wednesday, May 8, 2013 9:41 AM

Handling IE 9 & 10's and Chrome’s clear button with Knockout binding
Our tester found a bug with my search box. The search box filters a grid using observables. IE 9 and 10, and Crome adds in a x clear option, this wasn’t changing the observable, so the filter wasn’t getting cleared out. (image from SO question) <input id="searchTextBox" class="searchTextBox" type="text" maxlength="25" title="Search" placeholder="Search" data-bind="value: GridVm.FilterText, valueUpdate: 'afterkeydown', disable: GridVm.Data().length == 0" /> I posted my question and ended up ......

Posted On Tuesday, May 7, 2013 11:02 AM

Copyright © Aligned | Powered by: