1

Okay, this is a continuation of a previous question of mine, but it is distinct enough to be its own question. Based on user interaction, I'm calling a .ashx handler via a jquery ajax call, and that handler is building some html for me that includes some Telerik controls like a masked textbox (masked for a phone number like "(###) ###-####".

I got around all the hurdles of using Render() to get the html output of a server control even when it doesn't have a "Page" object or a ScriptHandler object.

However, when I show the control to a user, I see the mask in the text of the textbox, but the mask doesn't "work" in the sense that when a user starts typing, it is as if the mask is really just text.

So, my question is, after putting the html code out for a masked textbox, how do I tell whatever javascript is supposed to mask the input to really start masking on that specific control?

I really hope this made sense. Please tell me if you need any clarification.

1 Answer 1

1

Each ASP.NET AJAX control has a $create method to actually setup the AJAX features and to link the HTML elements to the AJAX component. In the JQuery success callback, you have to call this $create. For the syntax, look at a masked text box as it would appear normally on the page, meaning look for the following statement for the masked text box:

Sys.Application.add_init(function() {
   $create(...);
});

And copy that definition and use that for your dynamic masked textbox in the callback.

HTH.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Brian -- that did help. I haven't tried it out yet but I saw the code you were talking about, and I've identified the variable parts of it. You've given me a great pointer in the right direction, and thanks so much.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.