We use a technique of flushing text to the browser to show a progress indicator on pages that take a while to load.
We are basically sending html to display a GIF through the page_PreInit event as:
Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Response.AddHeader("Refresh", Convert.ToString((Session.Timeout * 60) + 5))
HttpContext.Current.Response.Buffer = True
HttpContext.Current.Response.Write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd'>")
HttpContext.Current.Response.Write("<html xmlns='http://www.w3.org/1999/xhtml'>")
HttpContext.Current.Response.Write("<div ID='divsplashScreen' runat='server'><table cellspacing='0' cellpadding='0' border='0' align='center'><tr><td class='copy' align='right' height='1'></td></tr><tr><td class='copyblack' style='font-family:tahoma;font-size:11px' align='center'><img src='images/progress.gif' border='0' align='absmiddle'><br></td></tr></table></div>")
HttpContext.Current.Response.Write("</body></html>")
HttpContext.Current.Response.Flush()
End Sub
For the most part this approach causes no problems. However with using the ItemsRequested() event for a ListBox on a page using this technique it fails. the ItemRequested() event fires and does not generate an error although the list box is not being populated by the this event. I am assuming that this is happening because the document is not well formed. Basically sending anything to the document prior to the DOCTYPE causing the event to fail.
Can anyone think of a way around this?
Robert
We are basically sending html to display a GIF through the page_PreInit event as:
Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Response.AddHeader("Refresh", Convert.ToString((Session.Timeout * 60) + 5))
HttpContext.Current.Response.Buffer = True
HttpContext.Current.Response.Write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd'>")
HttpContext.Current.Response.Write("<html xmlns='http://www.w3.org/1999/xhtml'>")
HttpContext.Current.Response.Write("<div ID='divsplashScreen' runat='server'><table cellspacing='0' cellpadding='0' border='0' align='center'><tr><td class='copy' align='right' height='1'></td></tr><tr><td class='copyblack' style='font-family:tahoma;font-size:11px' align='center'><img src='images/progress.gif' border='0' align='absmiddle'><br></td></tr></table></div>")
HttpContext.Current.Response.Write("</body></html>")
HttpContext.Current.Response.Flush()
End Sub
For the most part this approach causes no problems. However with using the ItemsRequested() event for a ListBox on a page using this technique it fails. the ItemRequested() event fires and does not generate an error although the list box is not being populated by the this event. I am assuming that this is happening because the document is not well formed. Basically sending anything to the document prior to the DOCTYPE causing the event to fail.
Can anyone think of a way around this?
Robert