Skip to content

Instantly share code, notes, and snippets.

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();
@siddharth-pandey
siddharth-pandey / gist:9467870
Created March 10, 2014 16:01
sessionwrapper above asp.net session
//(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()
{
@siddharth-pandey
siddharth-pandey / gist:9386512
Created March 6, 2014 10:01
code to create iframe.
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');
//css
<style>
.loaderwrapper {
border: 1px solid grey;
width: 100%;
height: 100%;
position: relative;
}
@siddharth-pandey
siddharth-pandey / gist:9207894
Last active August 29, 2015 13:56
route code sammy.js
//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" })
@siddharth-pandey
siddharth-pandey / gist:9111125
Created February 20, 2014 10:53
prevent click handler's by ko prevent Bubble
<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());
//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");
http://www.developerfusion.com/article/8307/aspnet-patterns-every-developer-should-know/
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Data;
public class TodoApiController : ApiController
{
private BetterMobileSpaContext db = new BetterMobileSpaContext();
// GET /api/todoapi
@siddharth-pandey
siddharth-pandey / gist:6087500
Created July 26, 2013 09:21
image replacement css and html. works even if CSS and Image is off in browser settinngs.
#HTML
<h1 class="technique-eight">
<span></span>CSS-Tricks
</h1>
#CSS
h1.technique-eight {
width: 350px; height: 75px;
position: relative;
}