Contents tagged with Javascript

  • The Mystery Of Javascript getDate vs getMonth Values

    Have you wondered why in Javascript, getMonth() returns a number from 0 to 11, whilst getDate() returns a number from 1 to 31? It turns out this isn't a mistake or an oversight, but by design; while it doesn't explicitly say so in (page 340), getMonth returns a 0-based integer so you can use it easily with an array of … more

  • How To Stop Visual Studio From Debugging Javascript Errors For A Website Project

    Have you found that Visual Studio doesn't listen to you when you tell it not to debug your Javascript? You've started an instance of it via the Debug menu, but you don't want to pause every time a script error happens - however, the Internet Explorer Advanced Options / "Disable script debugging" option does nothing, and neither does Just-In-Time / unchecking "Script" from Types of Code from … more

  • Debugging the Angular JS Routing Lifecycle

    On the first day at my new job at Tailster, I threw myself at diagnosing an Angular JS bug, despite my general lack of knowledge and experience in Angular. Long story short, if you ever need to trace what route and what controllers are being called, you can add the following code to your your rootscope function: $rootScope.$on('$stateChangeStart',function(event, toState, toParams, fromState, … more

  • Pro-Tip: MVC Bundling Gotchas - Minimized Files and Stylesheet Order

    A few quick tips for anyone who's attempting to add scripts or stylesheets via bundling in ASP.NET MVC and wondering why things aren't working. Minified Items Say you have the following in your App_Start\BundleConfig.cs: bundles.Add(new ScriptBundle("~/mybundle/sample").Include( "~/Content/Scripts/modernizr.custom.min.js", "~/Content/Scripts/site.src.js" )); … more

  • ASP.NET Javascript DoPostBack and SharePoint: Single Postback Issue

    Here's a quick tip (man, there sure has been a lot of SharePoint in my last few posts!) If you've got a Sharepoint page, and normal postbacks (like paging in your SPGridView or LinkButtons) stop working after you use a __doPostBack() javascript command, try adding the two settings just before your postback: _spFormOnSubmitCalled = false; _spSuppressFormOnSubmitWrapper=true; __doPostBack(' … more

  • SPGridView Deep Dive: Custom Filter Menu Values

    Over the last few days, I've learnt far more about SPGridView than I'd ever wanted to know, and here's a gnarly case I worked out and thought I'd share the knowledge! As a base, I'm hoping you've set up a fully functioning SPGridView with custom sort and paging - that's covered via a combination of my previous blog posts on SPGridViews and maybe this guide to the ObjectDataSource itself. If you' … more

  • SharePoint 2010 - Closing A Modal Dialog Within An UpdatePanel Programmatically

    SharePoint 2010 provides lots of nice of JavaScript helpers and methods, one category of which involves Modal Dialogs (eg the default behaviour when you view / edit a list item in a list). We can pretty easily create a modal dialog with a call to SP.UI.ModalDialog.showModalDialog(options) (and you can take a look at this blog post for a little more detail). So, let's imagine we open a dialog … more

  • Pro Tip: Client Side Validation with Nintex Forms

    To use the custom validation in Nintex, in the control settings, provide a method name for your custom validation for that specific control: And then you need to provide an implementation of the custom validation method you've named - this isn't documented anywhere on their site yet so I got the answer through a support ticket, but essentially you need to provide a method with the same name … more

  • PreSaveAction() - Custom JavaScript when submitting SharePoint ListForms

    Here's a short but quick SharePoint 2010 tip if you're looking to easily hook into the save event on list item forms (either New or Edit forms). All you need is a custom javascript function named PreSaveAction() - as part of the out of the box saving procedure in SharePoint 2010, this method will automatically be called prior to the item being committed. This is useful for fields that you've … more

  • Disabling Additional Form Validation In Sharepoint 2010

    This problem cost me about four hours of my life, and lots of tedious debugging in Firebug (what I would do without Firebug in my everyday development work, I am not quite sure...) The issue that I had was in a custom ASP.NET control hosted in Sharepoint that had a download file button. Prior to downloading a file, everything works as expected and all javascript calls proceed as per usual. … more

  • Checking Permissions with Javascript in Sharepoint 2007

    If you'll remember in my previous Sharepoint post regarding ECB customization, I was working on a custom Version History page. One of the modifications I finished today was changing the ECB for our custom Version History page to require additional permissions (in addition to the Delete Version permission) before displaying the Delete option in the ECB for that page. To do so, we just need to … more

  • Modifying Default ECB Menu Items In Sharepoint 2007

    Recently, I was tasked with replacing the out-of-the-box Version History menu item, and first of all came across the MSDN article on how to hide a menu item in the ECB. The original plan was to remove the existing item, and replace it with a custom Version History menu item - but the MSDN article recommends making an entire copy of core.js and modifying the copy, which seemed like a lot of … more

  • 1