Blog Archives


Howto: Fire an ASP.NET Validator from JavaScript

Let’s take an example of my previous post and make it little bit user friendly.  Here is the demo page link to see in live action. In the example(#1. Without ValidatorEnable), Custom validator fires and shows a validation message only

Posted in Microsoft Technology Tagged with: , ,

How to define Enum in JavaScript

Everybody familiar with Enum in server side scripting language.  I was wondering if we can define Enum type in JavaScript and I found that we can define type as Enum. Here is the syntax to define Enum. Here is example

Posted in Microsoft Technology Tagged with:

Check whether image exists on remote URL

Sometimes there is a situation where you need to display some default image if remote image URL does not exist. We have an application that shows up songs information from apple site and sometimes there is a missing artwork image.

Posted in Client Side Scripting Tagged with:

Run JavaScript when Ajax modal popup opens

Let’s say if you want to run some JavaScript method right after Ajax modal popup opens, we probably think injecting JavaScript method into page like this. if (!Page.IsStartupScriptRegistered(“PickerInit”)) Page.RegisterStartupScript(“pickerInit”,javascriptString); The JavaScript we inject using above method will be called on

Posted in Client Side Scripting, Microsoft Technology Tagged with: ,

JavaScript Timer Events

With JavaScript, it is possible to execute some code NOT immediately after a function is called, but after a specified time interval. This is called timing events. <html> <head> <script type=”text/javascript”> function timedMsg() { var t=setTimeout(“alert(‘5 seconds!’)”,5000) } </script> </head>

Posted in Client Side Scripting Tagged with: