execute javascript when a usercontrol become visible

I have a usercontrol wich is visible=false when the page is loaded. Then, it becomes visible=true. I want some javascript to be executed when this usercontrol is set to visible=true in the code-behind. the only solution i found is to use ScriptManager.RegisterStartupScript in the

usercontrol's code behind. But i don't like writing my javascript in the codeBehind.

This jQuery in the usercontrol doesn't work : $(document).ready(function() { alert('test'); });

The usercontrol is into an updatepanel.


Try this jQuery plugin. It makes use of the onpropertychange event in IE and the DOMAttrModified mutation event in supported browsers. With it, you should be able to watch for the visibility property being changed.

链接地址: http://www.djcxy.com/p/30986.html

上一篇: ASP.NET MVC:如何在Html.ActionLink中调用javascript函数

下一篇: 当usercontrol变得可见时执行javascript