observable properties design pattern in javascript
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
//use off to remove any other hanlder on this radio. | |
$('input:radio[name$="rblSourceAllocationType"]').off().on('click', function() { | |
//identify with something other then text!!! or use the filters as it is coz you are already using it on line 1560/1561 | |
if ($(this).val() == "Default") { | |
alert("Default radio"); | |
//perform some action | |
} | |
else if ($(this).val() == "Override") { | |
alert("Override radio"); |
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
<div class="outer" data-bind="click: toggleColor, css: bgColor"> | |
<p class="center"> | |
<input type="text" data-bind="preventBubble: 'click'"> | |
</p> | |
</div> | |
<script> | |
ko.bindingHandlers.preventBubble = { | |
init: function(element, valueAccessor) { | |
var eventName = ko.utils.unwrapObservable(valueAccessor()); |
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
//html | |
<form id="loginform" action="#/login" method="post" class="form-horizontal"> | |
<h4>Use a local account to log in.</h4> | |
<hr /> | |
@Html.ValidationSummary(true) | |
<div class="form-group"> | |
@Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" }) | |
<div class="col-md-10"> | |
@Html.TextBoxFor(m => m.UserName, new { @class = "form-control" }) |
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
//css | |
<style> | |
.loaderwrapper { | |
border: 1px solid grey; | |
width: 100%; | |
height: 100%; | |
position: relative; | |
} |
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
var iframeInstance = $('<iframe name="iframeHeader" id="iframeHeader"></iframe>'); | |
iframeInstance.css('display', 'none'); | |
iframeInstance.attr('width', '1300'); | |
iframeInstance.attr('height', '1300'); | |
iframeInstance.attr('scrolling', 'no'); | |
iframeInstance.attr('frameBorder', '0'); | |
iframeInstance.attr('align', 'center'); | |
iframeInstance.attr('valign', 'top'); | |
iframeInstance.attr('marginwidth', '0'); | |
iframeInstance.attr('marginheight', '0'); |
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
//(Updated for completeness) | |
//You can access session variables from any page or control using Session["loginId"] and from any class (e.g. from inside a class library), using System.Web.HttpContext.Current.Session["loginId"]. | |
//But please read on for my original answer... | |
//I always use a wrapper class around the ASP.NET session to simplify access to session variables: | |
public class MySession | |
{ | |
// private constructor | |
private MySession() | |
{ |
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
private List<string> SetupSelectionKeysForDisplay( | |
IPagedList<KeyValuePair<int, Dictionary<string, string>>> dataValuPagedList) | |
{ | |
string selectionKey = string.Empty; | |
string exp = "<(.*?)>"; | |
var reg = new Regex(exp); | |
MatchCollection matches = Regex.Matches(SelectionKeys, exp, RegexOptions.IgnoreCase); | |
IEnumerator en = matches.GetEnumerator(); |
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
[Thu Apr 24 2014 13:52:39 GMT+0100 (GMT Daylight Time)] #shell 404 Not Found get /Account/Login#/login | |
Error {message: "404 Not Found get /Account/Login#/login ", stack: "Error↵ at Object.Sammy.Application.$.extend.err…/localhost:36141/Scripts/Vendor/require.js:132:23"} | |
message: "404 Not Found get /Account/Login#/login " | |
stack: "Error↵ at Object.Sammy.Application.$.extend.error (http://localhost:36141/Scripts/Vendor/sammy-0.7.4.js:1346:47)↵ at Object.Sammy.Application.$.extend.notFound (http://localhost:36141/Scripts/Vendor/sammy-0.7.4.js:1335:22)↵ at Object.Sammy.Application.$.extend.runRoute (http://localhost:36141/Scripts/Vendor/sammy-0.7.4.js:1179:21)↵ at Object.Sammy.Application.$.extend._checkLocation (http://localhost:36141/Scripts/Vendor/sammy-0.7.4.js:1365:25)↵ at Object.Sammy.Application.$.extend.run (http://localhost:36141/Scripts/Vendor/sammy-0.7.4.js:971:12)↵ at http://localhost:36141/Scripts/App/common.js:36:19↵ at Object.context.execCb (http://localhost:36141/Scripts/V |
OlderNewer