I had the same issue and I tried to do the render logic but it still does not
flush out the results. Borrowing from the posted code this is what I did
protected override void Render(HtmlText Writer writer)
{
foreach (Selection in UsersSelection)
{
switch(Selectio n)
{
case "Selection 1":
UserControl1 uc1 = Page.LoadContro l("Control to be loaded") as UserControl1;
//Set user control properties
Panel.Control.A dd(uc1);
case "Selection 2":
UserControl1 uc2 = Page.LoadContro l("Control to be loaded") as UserControl1;
//Set user control properties
Panel.Control.A dd(uc2);
case "Selection 3":
UserControl1 uc3 = Page.LoadContro l("Control to be loaded") as UserControl1;
//Set user control properties
Panel.Control.A dd(uc3);
:
:
}
Panel.RenderCon trol(writer);
writer.Flush();
}
}
But that also does not seem to help at all. The page remains blank till the
entire results are returned, I expected to see some incremental flushing of
the results on to the screen so that the blank page does not exist. Any
ideas ?
"bruce barker" wrote:
you will need to take over the render logic yourself, rather then calling
base.Render(). this way you can render and flush each user control.
notes:
1) if your markup is complex, the browser may not render it anyway until get
gets the whole page.
2) if site has high volume you may runout of asp.net threads with this
approach, and your users get a server busy.
-- bruce (sqlwork.com)
"ScottOnes" <Sc*******@disc ussions.microso ft.com> wrote in message
news:32******** *************** ***********@mic rosoft.com... Hi
I have a placeholder that has multiple controls that need to be loaded and
rendered to the user based on some user selections. I have to loop through
the choices that the user makes and then load the controls. I am doing
this in the protected override void Render(HtmlText Writer writer) method.
protected override void Render(HtmlText Writer writer)
{
foreach (Selection in UsersSelection)
{
switch(Selectio n)
{
case "Selection 1":
UserControl1 uc1 = Page.LoadContro l("Control to be loaded") as
UserControl1; //Set user control properties
Panel.Control.A dd(uc1);
case "Selection 2":
UserControl1 uc2 = Page.LoadContro l("Control to be loaded") as
UserControl1; //Set user control properties
Panel.Control.A dd(uc2);
case "Selection 3":
UserControl1 uc3 = Page.LoadContro l("Control to be loaded") as
UserControl1; //Set user control properties
Panel.Control.A dd(uc3);
:
:
}
}
base.Render(wri ter);
}
But I want the page to be displayed as soon as the data from one control
has been obtained. Is there any way to do this ? I tried setting the
Response.Buffer to false and then flushing the results. But what happens
is that all the controls are looped through and then the entire data is shown
on the page at the same time which causes the page to be blank for a some
time.
Thanks a lot in advance for any help.