开发者

How to Write JavaScript for Templated Markup?

I'm a little stuck on this.

I've been assigned changes to make to an ASP.NET project. The WebForm I'm working on needs to dynamically display and hide controls in response to user actions.

开发者_如何学Go

So far, so good. My approach would be to create a little JavaScript. However, on this page, the markup is part of a template for a Telerik control (which I know nothing about). I'm not sure the ramifications of this. Can I still use JavaScript for templated markup?

I tried to insert some existing JavaScript in the page. The first problem I have is my use of <%= ControlName.ClientID %>, which produces an error because the name of the control in the template is not seen to exist by ASP.NET.

Is there another way to do this, or am I just going to run into more problems?


For template controls like repeater you should hook up the javascript from isnide the itembound event. Get the control using FindControl for each row and then register the javascript from code behind. I believe your telerik control should expose something similar to the itembound event that get called for every row..

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜