ASP.NET Rendering usercontrols with codebehind -
i want render usercontrol dynamicly code doesn't work expected. codebehind won't executed. here code rendering:
dim uccontrol usercontrol = loadcontrol(pcontrol.virtualpath & "/" & control & ".ascx") dim ucsb new stringbuilder dim ucsw new stringwriter(ucsb) dim uchtml new htmltextwriter(ucsw) uccontrol.rendercontrol(uchtml) thank help!
when rendering usercontorl normal lifecycle events not called. behavior design.
you cast usercontrol type , call methods explicitly:
dim uccontrol myusercontrol = ctype(loadcontrol(pcontrol.virtualpath & "/" & control & ".ascx"), myusercontrol) uccontrol.page_load(me, eventargs.empty)
Comments
Post a Comment