Formatting Dates with Knockout.js

Posted by & filed under Development, Web Development.

I am working on a couple of Silverlight projects using Microsoft Prism and found the MVVM pattern very powerful. The team at work is developing a single page HTML/Javascript application that is using Knockout as the MVVM framework. I wanted to bind a date using a custom format ‘dddd, MMMM dd, yyyy’. Since JavaScript doesn’t… Read more »

Using the DotNetNuke Profile Photo in a Custom Module

Posted by & filed under Development, DotNetNuke.

private string GetUserPhotoUrl(UserInfo user) { if (user.Profile.Photo == null || user.Profile.Photo == "-1") return user.Profile.PhotoURL; else return VirtualPathUtility.ToAbsolute("~/LinkClick.aspx") + "?fileticket=" + user.Profile.Photo; } An anonymous user or a user without a profile photo will always get the default no_avatar.gif image.

DotNetNuke MVP Module Development: Tip #2 Disable AutoDataBind

Posted by & filed under Development, DotNetNuke, Web Development.

In DotNetNuke MVP Module Development: Tip #1 The AutoDataBind Property I suggested to use AutoDatBind to automatically bind up the user control.  However, there are times when no binding should occur.  For example, when a Cancel button is clicked the view should not be bound.  AutoDataBind should be disabled when no model is need. protected… Read more »

Quick Tip: Use JQuery to submit a TextBox.

Posted by & filed under Development.

Submitting a search box when <Enter> is pressed is a nice usability feature to provide.  Unfortunately, ASP.NET Web Forms and its requirement for a single <form> tag breaks this expected behavior when there is more than one submit button on the page.   This can be easily fixed with a JavaScript and JQuery.   Listening to the… Read more »

DotNetNuke MVP Module Development: Tip #1 The AutoDataBind Property

Posted by & filed under Development, DotNetNuke.

The DotNetNuke.Web.Mvp.ModuleViewBase sets a property called AutoDataBind = true. As a result the DataBind() method for the page is always called in the Page_PreRenderComplete event. If you use the following familiar snippet of code you find that your controls will be data bound twice. Once when your code calls DataBind() and a second time when… Read more »

Offsetting the time zone in MS SQL 2005

Posted by & filed under Development.

I needed to offset the current time in MS SQL 2005 for a quick fix. I wanted to make sure the solution would not have to be maintained when daylight savings time changed. Taking the difference between the GETUTCDATE() and GETDATE() functions will generate the server’s current time zone offset from UTC time. DECLARE @timezoneOffset… Read more »