A Post action should redirect to a Get action rather than returning a View. This avoids the annoyance of the browser displaying the "do you want to resubmit the form" message if the user tries to refresh the page after the Post.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("form[data-block-page-on-submit]").each(function () { | |
$(this).validate().settings.submitHandler = function () { | |
window.BlockPage(); | |
return true; | |
}; | |
}); |
Develop an unobtrusive approach - if a form has the data-warn-unsaved="true" attribute then attach change event handlers to its fields. Do this for all such forms on the page. The handlers can set data-unsaved-changes="true" on the form.
Set window.onbeforeunload to a function that checks for any forms with data-unsaved-changes="true". If any such forms are found, return some text to be displayed as a prompt to the user.
When a form's contents are saved successfully, we want to set data-unsaved-changes="false". Define an event that can be invoked upon a successful save, in order to set the attribute's value?
Also see http://codethug.com/2013/02/01/knockout-binding-for-onbeforeunload/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Configuration; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Config | |
{ | |
public abstract class BaseConfigurationElementCollection<TKey, TElement> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data.SqlTypes; | |
using System.Globalization; | |
using System.Linq; | |
using System.Text; | |
namespace Utility | |
{ | |
// http://dotnetslackers.com/articles/aspnet/5-Helpful-DateTime-Extension-Methods.aspx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @cmd1 VARCHAR(MAX) | |
DECLARE @cmd2 VARCHAR(MAX) | |
IF EXISTS (SELECT object_id FROM tempdb.sys.objects WHERE name like '#OrphanUsers%') | |
DROP TABLE #OrphanUsers | |
CREATE TABLE #OrphanUsers | |
( | |
UserName VARCHAR(50) NULL, | |
userSID VARBINARY(85) NULL, | |
dbName VARCHAR(50) NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://dillieodigital.wordpress.com/2011/10/12/automatic-user-and-time-stamping-in-entity-framework-4/ | |
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.Data.Objects; | |
using System.Web; | |
using MyApp.BLL; | |
namespace MyApp.DAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using Microsoft.Practices.Unity; | |
using Unity.Mvc4; | |
namespace MvcApplication1 | |
{ | |
public static class Bootstrapper | |
{ | |
public static void Initialise() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WorkspaceReloader | |
AutoMapper | |
DataAnnotationsExtensions.MVC3 | |
ELMAH.MVC | |
Modernizr | |
Twitter.Bootstrap | |
SlickGrid | |
Select2.js | |
jQuery | |
jQuery.UI.Combined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This script should have a Build Action of PostDeploy within the Visual Studio project. */ | |
/* | |
Post-Deployment Script Template | |
-------------------------------------------------------------------------------------- | |
This file contains SQL statements that will be appended to the build script. | |
Use SQLCMD syntax to include a file in the post-deployment script. | |
Example: :r .\myfile.sql | |
Use SQLCMD syntax to reference a variable in the post-deployment script. | |
Example: :setvar TableName MyTable |
NewerOlder