Tag Archives: Javascript

JavaScript ReferenceError: Can’t find variable: __doPostBack

This error can occur in asp.net pages. In certain situations .net will fail to create the __doPostBack JavaScript function and the hidden __EVENTVALIDATION input field. The situations that can cause this are: When using asp:ImageButton or asp:LinkButton controls AND: When viewing … Continue reading


Posted in .net, c#, General .NET | Tagged , , , , | 1 Comment

.NET DateTime to JSON UNIX JavaScript datetime

When posting datetimes to web services or REST services, you might need to convert the standard .NET DateTime to a UNIX format. Please note than neither REST, nor JavaScript has its own DateTime format. But some systems based on REST … Continue reading

Posted in c#, General .NET | Tagged , , , , | 2 Comments

showModalDialog returnValue is undefined in Google Chrome

For some reason, when using a Javascript showModalDialog from an ASP.NET project, Google Chrome will return an empty (“undefined”) returnValue. This error has been known by the Google Chromium team since 2010, and they have yet to fix it. Fortunately … Continue reading

Posted in Uncategorized | Tagged , , , | 4 Comments

Validate CheckBoxList using a CustomValidator

In this article I explain how you can validate that at least one checkbox is checked in an asp:CheckBoxList using an asp:CustomValidator, and how to make it work server side and client side. None of the built in .net validators … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , , , , , | 6 Comments

Javascript string encoding in C#

In a previous post I explained how you can use the C# System.Uri.EscapeDataString() to encode strings to be later decoded by the equvivalent JavaScript decodeURIComponent(). The method above is still valid when encoding HTML tags, but fails short when encoding … Continue reading

Posted in .net, c#, General .NET | Tagged , , , | 4 Comments

Modal windows does not resize automatically

I’m not sure if this is a bug or a feature, but when using modal windows in Internet Explorer, your HTML is not updated when the window.onresize event is fired. This is pretty annoying, since it is possible and even … Continue reading

Posted in .net, General .NET | Tagged , , | 1 Comment

Waiting for gg.google.com

I am developing a Google Maps module for Sitecore, and when I test it in Firefox my Google Javascript won’t load. All I get is: “Waiting for gg.google.com…”. It seemes to be a problem with certain versions of Firefox and Firebug. If Firebug … Continue reading

Posted in General .NET | Tagged , , , , | 11 Comments

decodeURIComponent() equivalent in C#

The Javascript decodeURIComponent()  function decodes a string that was URI encoded with the encodeURIComponent() Javascript function. If you wish to encode a string in C# that can be decoded with decodeURIComponent you have to use the EscapeDataString function: The escaping … Continue reading

Posted in General .NET | Tagged , , | 7 Comments