多个用户控件实例和客户端ID在J​​S [英] Multiple user control instances and ClientID in JS

查看:158
本文介绍了多个用户控件实例和客户端ID在J​​S的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用<%=客户端ID%>在JavaScript中获得动态加载的用户控件的ID。

I am using <%= ClientID %> in the javascript to get the ID of a dynamically loaded user control.

直到同一控制的多个实例加载一切正常。该ID指向最后添加的用户控件的ClientID的。

Everything works fine until multiple instances of the same control are loaded. The ID points to the ClientID of the user control that was added last.

我要如何解决这个问题?

How do I solve this issue?

编辑:
我做了:
在JavaScript%=客户端ID%>; VAR CLID = LT。
问题是CLID被覆盖每次同UC加载

推荐答案

这听起来像它会更容易使你的控制范围内调用你的JS功能和ID或引用传递给JS功能。

It sounds like it would be easier to render the call to your JS function within your control and pass the ID or reference to the JS function.

这篇关于多个用户控件实例和客户端ID在J​​S的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆