Is User Control in Asp.Net can be completely self contain? -
i trying make usercontrol have data process, initialize data, ajax, self contain 1 control. can insert anywhere on asp pages.
but problem is, usercontrol contains script manager , page contain user control has script manager too, asp doesn't allow me have 2 script manager in 1 page.
in case this, wonder if usercontrol can self contain? or proper way of using usercontrol using template, , data process, event handler have on page contains usercontrol?
thanks.
======edit: guess use scriptmanager.getcurrent check if page exists scriptmanager , add otherwise. thanks.
for part, can make self-contained. use clientscript
object. this:
if (!page.clientscript.isclientscriptblockregistered("key")) { page.clientscript.registerclientscriptblock(gettype(), "key", "function myfunction() {" + "..." + "}", true); }
by providing unique key code block, can ensure particular block of javascript added page once, , once.
Comments
Post a Comment