开发者

ASP.Net AJAX controls, adding via .ashx page

Okay, t开发者_JAVA技巧his 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜