My issue: Purposefully execute a .NET WebMethod via POST without passing it parameters. I use $.ajaxSetup to configure my page's calls, so I'm assuming this is where my snag came up, but I didn't want to have to work around this and make my $.ajax() calls more verbose.
Simple answer: encode an empty JSON object, and it won't be passed to the WebMethod when contentType is JSON.
Wednesday, May 28, 2014
Visual Studio and Javascript Intellisense
I don't know why I didn't track this down earlier, but as I was coding some jQuery AJAX today, I thought to myself, why isn't there Intellisense for jQuery? I mean, MS supports a whole plethora of other items, including Python, so why not js? Well it seems I just didn't do a quick Google search to find out about the ~/Scripts/_references.js file.
_references.js
It's really simple, you just add references to your js files in this folder of the format:
/// <reference path="jquery-1.10.1.js" />
And voila, I have intellisense. And if you're really lazy you can simply
- right-click this file -->
- "Auto-sync Javascript references"
- "Update Javaascript references"
And anytime you add or remove a file, this reference is updated.
Sources:
http://madskristensen.net/post/the-story-behind-_referencesjs
http://www.asp.net/visual-studio/overview/2012/visual-studio-2012-javascript-editor
Tuesday, May 20, 2014
Python-like loops in C#
I just stumbled across this today as I was looking to use Enumerable.Range():
You can use Enumerable.Range(start, end), close to Python's own Range function. For instance this should look familiar:
C#
Python
You can use Enumerable.Range(start, end), close to Python's own Range function. For instance this should look familiar:
C#
Python
Friday, May 16, 2014
Disable Chrome's Notification Icon
I stole this from a forum, to re-post here.
1. In the Chrome address field, type: chrome://flags
2. On the page that loads up, scroll down until you see "Enable Rich Notifications Mac, Windows", and select "Disabled".
1. In the Chrome address field, type: chrome://flags
2. On the page that loads up, scroll down until you see "Enable Rich Notifications Mac, Windows", and select "Disabled".
Wednesday, February 5, 2014
Basics of Installing jQueryUI in .NET MVC with bundles
jQueryUI is sometimes installed by default, depending on the template. If you find you need to install jQueryUI, follow the following steps.
* Note that this is assuming you use the default jQueryUI themes and want to include all style sheets (i.e., jquery.ui.all.css), as well as load these in the master layout.
* You can create bundles anyway you want, I included it with the jQuery bundle for simplicity.
- Install "jQueryUI combined" package from nuget
- Open ~/App_Start/BundleConfig.cs
- Add jQueryUI script and CSS to bundle
- bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js" ,"~/Scripts/jquery-ui-{version}.js" ));
- bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.css","~/Content/site.css","~/Content/themes/base/jquery.ui.all.css" ));
- Make sure ~/Views/Shared/_Layout.cshtml is loading these:
- @ Styles.Render( "~/Content/css")
- @Scripts.Render( "~/bundles/jquery")
Thursday, January 30, 2014
Getting DevExpress to work with Visual Studio Express 2013 for Web
When I installed VS 2013 Express for Web I'd intended on using the free trial of DevExpress to see what it was all about; however whenever I would install it, the Template Wizard wouldn't appear. I looked through the forums for a quite a while, and was able to get it to work by doing the following steps.
The key here is to install the hotfix instead of the Dev Express Universal Trial 20131228
This applies to: DevExpress Universal Trial 20131228
Steps
- Download the hotfix v2013 2.7
- You will probably need a free account to download, but you should already have one at this point
- The file should be "DevExpressComponents-13.2.6.14034.exe" --> note the version, as there are a few posted to the forums. This was the newest one that was sent to me, at this time.
- Fire-up VS 2013 Express for Web & Create a New Project
- Select the Template Gallery from Templates --> Visual C# heading
Note that MVC is still not working as I receive a "MVC is not installed" error, however you can now use the template wizard to fire up a Webforms project and take DevExpress for a spin.
I will update this post when my ticket is finally resolved for MVC.
I will update this post when my ticket is finally resolved for MVC.
Wednesday, January 29, 2014
MVC 5 & Razor & Html Helpers
Issue: After some searching around on SO, MSDN, and various other blogs, I wasn't able to get a good list of Html helpers out there for Razor. I'm sure such a list exists, but I couldn't seem to find one. So mostly for my own reference, here is a list that I took from the MSDN page, that I pared-down by eliminating the overloads.
I understand that VS Intellisense will give you a similar list, but I feel that a quick-reference list is at times better.
http://msdn.microsoft.com/en-us/library/system.web.mvc.htmlhelper(v=vs.118).aspx
HTML Helper methods:
I understand that VS Intellisense will give you a similar list, but I feel that a quick-reference list is at times better.
http://msdn.microsoft.com/en-us/library/system.web.mvc.htmlhelper(v=vs.118).aspx
HTML Helper methods:
- Html.TextBoxFor()
- Html.TextAreaFor()
- Html.DropDownListFor()
- Html.CheckboxFor()
- Html.RadioButtonFor()
- Html.ListBoxFor()
- Html.PasswordFor()
- Html.HiddenFor()
- Html.LabelFor()
- Html.EditorFor()
- Html.DisplayFor()
- Html.DisplayTextFor()
- Html.ValidationMessageFor()
- Html.DisplayNameForModel()
- Html.EditorForModel()
- Html.LabelForModel()
- Html.NameForModel
- Html.ValueForModel()
- Html.Action()
- Html.ActionLink()
- Html.BeginForm()
- Html.BeginRouteForm()
- Html.Checkbox()
- Html.Display()
- Html.DisplayName()
- Html.DisplayText()
- Html.DropDownList()
- Html.Editor()
- Html.EndForm()
- Html.Hidden()
- Html.Id
- Html.IdForModel
- Html.Label()
- Html.ListBox()
- Html.Name
- Html.Partial()
- Html.Password()
- Html.RadioButton()
- Html.RenderAction()
- Html.RenderPartial()
- Html.RouteLink()
- Html.TextArea()
- Html.TextBox()
- Html.Validate
- Html.ValidationMessage()
- Html.ValidationSummary()
- Html.Value()
Subscribe to:
Comments (Atom)