Skip to content

Instantly share code, notes, and snippets.

@siddharth-pandey
siddharth-pandey / CSS IR
Last active October 11, 2015 06:08 — forked from attegists/CSS: IR
CSS: IR
.ir {
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
[Bb]in
[Oo]bj
*.suo
*.user
@siddharth-pandey
siddharth-pandey / gist:4236925
Created December 7, 2012 22:11
no script tag javascript script tag
n the head <meta http-equiv="refresh" content="1" id="refresh">
and also in the head
<script>
var r = document.getElementById('refresh');
r.parentNode.removeChild(r); // meta refresh that is removed in JS... therefore if JS is disabled the page will refresh. iirc you can navigate to a new page with meta tags as well.
</script>
@siddharth-pandey
siddharth-pandey / gist:4548853
Created January 16, 2013 17:07
checkboxlist mvc
@*<div class="controls">
@for (int i = 0; i < Model.MarketingCodes.Count(); i++)
{
var name = @Model.MarketingCodes[i].name.ToString();
<label for="@Model.MarketingCodes[i].name" class="checkbox inlineblock">
@Html.CheckBoxFor(model => model.MarketingCodes[i].selected, new { name = @Model.MarketingCodes[i].name.ToString(), @id = @Model.MarketingCodes[i].name.ToString() })
@Model.MarketingCodes[i].name
</label>
@Html.HiddenFor(model => model.MarketingCodes[i].name)
@siddharth-pandey
siddharth-pandey / gist:4593384
Created January 22, 2013 09:44
Multiple Submit button on a single MVC form Leaving the question of weather this is a good practice or not, there is a way to have multiple submit buttons on a single form. Clicking on any of the buttons will post to the same action, so how do you tell which one was clicked.
//On your View:
//view plaincopy to clipboardprint?
@using (Html.BeginForm())
{
//other fields here.....
<input type="submit" value="Save1" name="submitButton" id="submitButton">
<input type="submit" value="Save2" name="submitButton" id="submitButton">
}
@siddharth-pandey
siddharth-pandey / jquery onblur validatation instead of onkeyup
Created January 22, 2013 09:55
jquery onblur validatation instead of onkeyup
$('form').validate({rules: {...},
onkeyup: false});
@siddharth-pandey
siddharth-pandey / gist:4596247
Created January 22, 2013 16:56
MVC binding to model with list property
<div class="editor-field">
@for (int i = 0; i < Model.Data.Count(); i++)
{
@Html.HiddenFor(m => m.Data[i].Id)
@Html.HiddenFor(m => m.Data[i].ParentId)
@Html.HiddenFor(m => m.Data[i].Name)
@Html.TextBoxFor(m => m.Data[i].Value)
}
</div>
@siddharth-pandey
siddharth-pandey / git proxy settings
Created January 28, 2013 12:28
git proxy settings - run this in git bash or terminal
To configure Git to use an Internet Proxy:
If your computer passes through a Proxy in order to access the Internet, then Git must be configured to use this Proxy when interacting with repositories on the Internet. The command to enable Git to use a Proxy is:
git config –global http.proxy http://our-proxy-server:8088
@siddharth-pandey
siddharth-pandey / call jquery function from c#
Created January 28, 2013 22:33
call jquery function from c#
ScriptManager.RegisterClientScriptBlock(this, Page.GetType(), "a", "window.onload = function () { $('#NewUserDialog').dialog('open'); }", true);
@siddharth-pandey
siddharth-pandey / gist:4673831
Created January 30, 2013 14:58
event.prevent default => If this method is called, the default action of the event will not be triggered.
//jqprint() for printing pcl details on click
$('PrintPCLDetails').live('click', function (event) {
event.preventDefault();
$('#terms').jqprint();
});