Asp。网络用户控制 [英] Asp . net User Control

查看:83
本文介绍了Asp。网络用户控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用户控件。在这个用户控件里面它有一些子控件和一些javascript代码。当我在页面中使用一次时,此控件正常工作。但问题是,当我尝试在同一页面中多次使用它时,问题就出现了。问题是,当我触发第一个用户控件子控件事件时,它会自动触发第二个控件同一事件。 Plz有人帮我解决了这个问题。

I have one user control. Inside this user control it have some child control and also some javascript code. This control is working fine when i am using once in a page. But problem is that when i am try to use it multiple time in the same page the problem is arise. Problem is that when i fire th first user control child control event it automatically fire the second control same event. Plz some one help me to resolve this problem.

推荐答案

试试下面可能有用的代码。

Try the below code it may work.


document )。ready( function (){
(document).ready(function() {


#usercontrolID .elementClass)。click( fuction(){

});


});
("#usercontrolID .elementClass" ).click( fuction() { }); }) ;



尝试编写Javascript in您调用用户控件的页面,以便它可以修复。为每个单独的用户控件创建事件,以便仅为上述用户控件元素触发事件。


Try to write Javascript in the page which ur calling the user control so it may fix.Create event for each individual user control so the event will be fired only for that user control element only as above.


这篇关于Asp。网络用户控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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