Archive for September, 2010

Replace white spaces – blank spaces in string using Javascript

September 27, 2010 Leave a comment

Regex make our life simpler, and when used properly can create miracles. One such example  Regex is given below which replaces white spaces/blank spaces in string using javascript :

function ReplaceWhiteSpaces()
 var text = "Example to Replace white spaces in strings";
 text = text.replace(/\s/g, "-");

Output : Example-to-Replace-white-spaces-in-strings

Regex Used : /\s/g

Get Client ID using Jquery

September 20, 2010 1 comment

When we are developing client side in, we need the id of the controls, but the IDs are merged with master page naming containers.

The id will look something like this

But using Jquery we can get id like this

$("#<%= <strong>txtboxId</strong>.ClientID %>")
$("[id$=_<strong> txtboxId</strong>]").attr("id")

You can also use the function

function GetClientID(id, context) {
var el = $("#" + id, context);
if (el.length < 1)
el = $("[id$=_" + id + "]", context);
return el;



Or if I want to be specific about the container:

For More Details Visit:

Solving Calendar Extender Problem in Modal Popup Extender

September 13, 2010 3 comments

Calendar Extender control when placed inside modal popup extender will not be seen in front. To solve this issue, we have the following solution

<cc1:CalendarExtender ID="CalendarExtender1" TargetControlID="Textbox1"
 PopupPosition="Right" runat="server" <strong>OnClientShown="CalendarShown"></strong> </cc1:CalendarExtender>
function calendarShown(sender, args)
    { = 10005;