asp.net - Best way of handling javascript within Custom Controls? -
I have some custom controls in ASP.Net that I have made. I used jQuery where it also helped. Well, a problem that I have (with a clear but "bad" workaround) is that for every user control, I executed some code from within Well now my problem is that I have to attach two custom controls to What would be the best way to do this? I just can not do Because these custom controls can be used more than once on the page and the script needs to be run for each instance of control, plus what If there are 3 different custom controls on the page? The only way with which I came, it is something that looks like a super hack: Are there any better ways to sort out these kinds of functions? I have also seen this, but whatever suggestions I give, I feel bad about what I am currently doing. pageLoad
( $ (document) / Code> will not work with the updated panel).
pageLoad
event
old_pageLoad = pageLoad pageLoad = function () {. .. old_pageLoad ();}
old_pageLoad_ <% = MyStaticClass.GetUniqueID ()% & Gt; = Pageload; PageLoad = function () {... old_pageLoad_ & lt;% = MyStaticClass.GetUniqueID ()% & gt; ();}
ScriptManager
. When you enter the script, you pass in the context of your control, and ensures that whenever the control is updated (the first page load, or when the update panel is updated) the initial script goes.
Comments
Post a Comment