PreRender on my User control not firing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tshad

    PreRender on my User control not firing

    In VS 2008, I have 2 pages, one aspx page and one ascx page.

    The PreRender event is not firing on the Contol page.

    The aspx page starts out:

    <%@ Page Language="VB" AutoEventWireup ="true" Trace="true"
    CodeFile="TakeS urveyTest.aspx. vb" Inherits="TakeS urveyTest" %>
    And the ascx page starts out:

    <%@ Control Language="VB" AutoEventWireup ="true"
    CodeFile="TakeS urveyTest.ascx. vb" Inherits="TakeS urveyTest" %>

    The PreRender code on my ascx page is:

    Sub Page_PreRender( ByVal Sender As Object, ByVal E As EventArgs)
    viewstate("Time Start") = TimeStart
    viewstate("Scre enRight") = ScreenRight
    viewstate("Scre enWrong") = ScreenWrong
    viewstate("Last Time") = LastTime
    End Sub


    The control works fine other than that.

    What is missing?

    Thanks,

    Tom


  • tshad

    #2
    Re: PreRender on my User control not firing

    I figured it out.

    The control wasn't visible - so it didn't fire.

    Tom

    "tshad" <tfs@dslextreme .comwrote in message
    news:%23CHzYDJJ JHA.6088@TK2MSF TNGP04.phx.gbl. ..
    In VS 2008, I have 2 pages, one aspx page and one ascx page.
    >
    The PreRender event is not firing on the Contol page.
    >
    The aspx page starts out:
    >
    <%@ Page Language="VB" AutoEventWireup ="true" Trace="true"
    CodeFile="TakeS urveyTest.aspx. vb" Inherits="TakeS urveyTest" %>
    And the ascx page starts out:
    >
    <%@ Control Language="VB" AutoEventWireup ="true"
    CodeFile="TakeS urveyTest.ascx. vb" Inherits="TakeS urveyTest" %>
    >
    The PreRender code on my ascx page is:
    >
    Sub Page_PreRender( ByVal Sender As Object, ByVal E As EventArgs)
    viewstate("Time Start") = TimeStart
    viewstate("Scre enRight") = ScreenRight
    viewstate("Scre enWrong") = ScreenWrong
    viewstate("Last Time") = LastTime
    End Sub
    >
    >
    The control works fine other than that.
    >
    What is missing?
    >
    Thanks,
    >
    Tom
    >
    >

    Comment

    • tshad

      #3
      Re: PreRender on my User control not firing

      But there lies the question.

      If you set the control as visible=false and the PreRender event doesn't
      fire - does the PageLoad event fire?

      Also, I assume the IsPostBase is based on the page and not the control. But
      if that is the case, how do you initialize the control.

      I would normally do that in the "if not IsPostBack" code of my PageLoad
      event. But will that happen when the control is not visible?

      Thanks,

      Tom

      "tshad" <tfs@dslextreme .comwrote in message
      news:ewAWy6JJJH A.1308@TK2MSFTN GP02.phx.gbl...
      >I figured it out.
      >
      The control wasn't visible - so it didn't fire.
      >
      Tom
      >
      "tshad" <tfs@dslextreme .comwrote in message
      news:%23CHzYDJJ JHA.6088@TK2MSF TNGP04.phx.gbl. ..
      >In VS 2008, I have 2 pages, one aspx page and one ascx page.
      >>
      >The PreRender event is not firing on the Contol page.
      >>
      >The aspx page starts out:
      >>
      ><%@ Page Language="VB" AutoEventWireup ="true" Trace="true"
      >CodeFile="Take SurveyTest.aspx .vb" Inherits="TakeS urveyTest" %>
      >And the ascx page starts out:
      >>
      ><%@ Control Language="VB" AutoEventWireup ="true"
      >CodeFile="Take SurveyTest.ascx .vb" Inherits="TakeS urveyTest" %>
      >>
      >The PreRender code on my ascx page is:
      >>
      > Sub Page_PreRender( ByVal Sender As Object, ByVal E As EventArgs)
      > viewstate("Time Start") = TimeStart
      > viewstate("Scre enRight") = ScreenRight
      > viewstate("Scre enWrong") = ScreenWrong
      > viewstate("Last Time") = LastTime
      > End Sub
      >>
      >>
      >The control works fine other than that.
      >>
      >What is missing?
      >>
      >Thanks,
      >>
      >Tom
      >>
      >>
      >
      >

      Comment

      Working...