c# - Can't render child control which contains repeat items? -


i newbiesin webform. want render "usercontrol1" in webform page. in "usercontrol1" assign list child usercontrol("usercontrol2") in has "asp:repeater" template. dom in "usercontrol2" except "asp:repeater" has rendered.

webform page:

protected override void onprerender(eventargs e)     {         var control1 = (webusercontrol1)page.loadcontrol("~/webusercontrol1.ascx");         htmltextwriter htmlwriter = new htmltextwriter(new stringwriter());         control1.controlrender();         control1.rendercontrol(htmlwriter);         string html = htmlwriter.innerwriter.tostring();         base.onprerender(e);     } 

usecontrl1:

public void controlrender()     {         onprerender(null);     }  protected override void onprerender(eventargs e)     {         list<string> list=new list<string> {"1", "2", "3"};         usecontrol2.products = list;     } 

thanks in advance.

i find "onprerender" method in "usercontrol2" not firing, , because don't want change autoeventwireup value, solve adding public method in "usercontrol2" call "onprerender" manually.like:

public void controlrender() {     onprerender(null); } 

any suggestions , opinions welcome.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -