Page_Load vs Submit_Click - which one first?

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

    #1

    Page_Load vs Submit_Click - which one first?

    Question:

    During the execution of code, which one is looked at first; the
    Page_Load, or the Submit_Click?

    My problem arises when I specify a literal in the Page_Load, and attach
    it to the page dynamically. When I assign it content in the Submit_Click
    (say, a “update successful!” message), nothing shows up. Why? If the
    Page_Load (or the Page_Init, neither works in my case) is supposed to
    place content on the page prior to Submit_Click being fired, why won’t a
    ltrlContent.Tex t = "some content" work from inside the Submit_Click if
    the literal has been set in the Page_Load?

    For example, the following (highly edited and cut down) code simply
    doesn’t work:

    Dim ltrlContent As New Literal()
    Sub Page_Load(...)
    ...
    myForm.Controls .Add(ltrlConten t)
    ...
    End Sub
    Private Sub Submit_Click(.. .)
    ltrlContent.Tex t = "Update Successful!"
    End Sub

    TIA
    ...Geshel
    --
    *************** *************** *************** *************** ***********
    * My reply-to is an automatically monitored spam honeypot. Do not use *
    * it unless you want to be blacklisted by SpamCop. Please reply to my *
    * first name at my last name dot org. *
    *************** *************** *************** *************** ***********
    * “I contend that we are both atheists. I just believe in one fewer *
    * god than you do. When you understand why you dismiss all the other *
    * possible gods, you will understand why I dismiss yours.” *
    * - Stephen F. Roberts *
    *************** *************** *************** *************** ***********
    * “Anyone who believes in Intelligent Design (“creationism ”) is just *
    * as ignorant, irrational and ill-educated as someone who believes *
    * that the world is a flat disc, that the Sun circles the Earth or *
    * that there really is a tooth fairy. Darwinism has an overwhelming *
    * foundation of evidence that can be tested and reproduced. *
    * *
    * “Intelligent Design, on the other hand, has no evidence at all;not *
    * one single shred of testable proof. As such, Intelligent Design is *
    * Religious Mythology, and has no right whatsoever to be in our *
    * Science classrooms.” - 99.99+% of Scientists *
    *************** *************** *************** *************** ***********
    Mignon McLaughlin once said that “A nymphomaniac is a woman [who is] as
    obsessed with sex as the average man.” Unfortunately, since true
    nymphomaniacs are so rare, this means that it takes an extraordinary
    woman to keep up with an ordinary man.
    *************** *************** *************** *************** ***********
  • Marina Levit [MVP]

    #2
    Re: Page_Load vs Submit_Click - which one first?

    Are you sure Submit_Click is attached as the Click event handler to a
    button? You didn't have a 'Handles Submit.Click' on there, I don't know if
    that is just an omission or if it's actually not there.

    Have you tried debugging into Submit_Click and seeing if it ever gets
    called?

    I suspect the handler is not being attached correctly.

    "Neo Geshel" <gotcha@geshel. org> wrote in message
    news:iKYTf.1700 58$B94.88432@pd 7tw3no...
    Question:

    During the execution of code, which one is looked at first; the
    Page_Load, or the Submit_Click?

    My problem arises when I specify a literal in the Page_Load, and attach
    it to the page dynamically. When I assign it content in the Submit_Click
    (say, a "update successful!" message), nothing shows up. Why? If the
    Page_Load (or the Page_Init, neither works in my case) is supposed to
    place content on the page prior to Submit_Click being fired, why won't a
    ltrlContent.Tex t = "some content" work from inside the Submit_Click if
    the literal has been set in the Page_Load?

    For example, the following (highly edited and cut down) code simply
    doesn't work:

    Dim ltrlContent As New Literal()
    Sub Page_Load(...)
    ...
    myForm.Controls .Add(ltrlConten t)
    ...
    End Sub
    Private Sub Submit_Click(.. .)
    ltrlContent.Tex t = "Update Successful!"
    End Sub

    TIA
    ....Geshel
    --
    *************** *************** *************** *************** ***********
    * My reply-to is an automatically monitored spam honeypot. Do not use *
    * it unless you want to be blacklisted by SpamCop. Please reply to my *
    * first name at my last name dot org. *
    *************** *************** *************** *************** ***********
    * "I contend that we are both atheists. I just believe in one fewer *
    * god than you do. When you understand why you dismiss all the other *
    * possible gods, you will understand why I dismiss yours." *
    * - Stephen F. Roberts *
    *************** *************** *************** *************** ***********
    * "Anyone who believes in Intelligent Design ("creationis m") is just *
    * as ignorant, irrational and ill-educated as someone who believes *
    * that the world is a flat disc, that the Sun circles the Earth or *
    * that there really is a tooth fairy. Darwinism has an overwhelming *
    * foundation of evidence that can be tested and reproduced. *
    * *
    * "Intelligen t Design, on the other hand, has no evidence at all; not *
    * one single shred of testable proof. As such, Intelligent Design is *
    * Religious Mythology, and has no right whatsoever to be in our *
    * Science classrooms." - 99.99+% of Scientists *
    *************** *************** *************** *************** ***********
    Mignon McLaughlin once said that "A nymphomaniac is a woman [who is] as
    obsessed with sex as the average man." Unfortunately, since true
    nymphomaniacs are so rare, this means that it takes an extraordinary
    woman to keep up with an ordinary man.
    *************** *************** *************** *************** ***********


    Comment

    • Neo Geshel

      #3
      Re: Page_Load vs Submit_Click - which one first?

      Marina Levit [MVP] wrote:[color=blue]
      > Are you sure Submit_Click is attached as the Click event handler to a
      > button? You didn't have a 'Handles Submit.Click' on there, I don't knowif
      > that is just an omission or if it's actually not there.
      >
      > Have you tried debugging into Submit_Click and seeing if it ever gets
      > called?
      >
      > I suspect the handler is not being attached correctly.
      > [/color]

      The handler is being attached correctly. I use the following:

      AddHandler submit.Click, AddressOf Submit_Click

      To connect the button to Submit_Click. The button is being attached to
      the page in the following way:

      Dim preview As New Button()
      myForm.Controls .Add(preview)
      AddHandler submit.Click, AddressOf Submit_Click
      preview.id = "preview"
      preview.Text = "Preview News Article"

      TIA
      ...Geshel
      --
      *************** *************** *************** *************** ***********
      * My reply-to is an automatically monitored spam honeypot. Do not use *
      * it unless you want to be blacklisted by SpamCop. Please reply to my *
      * first name at my last name dot org. *
      *************** *************** *************** *************** ***********
      * “I contend that we are both atheists. I just believe in one fewer *
      * god than you do. When you understand why you dismiss all the other *
      * possible gods, you will understand why I dismiss yours.” *
      * - Stephen F. Roberts *
      *************** *************** *************** *************** ***********
      * “Anyone who believes in Intelligent Design (“creationism ”) is just *
      * as ignorant, irrational and ill-educated as someone who believes *
      * that the world is a flat disc, that the Sun circles the Earth or *
      * that there really is a tooth fairy. Darwinism has an overwhelming *
      * foundation of evidence that can be tested and reproduced. *
      * *
      * “Intelligent Design, on the other hand, has no evidence at all;not *
      * one single shred of testable proof. As such, Intelligent Design is *
      * Religious Mythology, and has no right whatsoever to be in our *
      * Science classrooms.” - 99.99+% of Scientists *
      *************** *************** *************** *************** ***********
      Mignon McLaughlin once said that “A nymphomaniac is a woman [who is] as
      obsessed with sex as the average man.” Unfortunately, since true
      nymphomaniacs are so rare, this means that it takes an extraordinary
      woman to keep up with an ordinary man.
      *************** *************** *************** *************** ***********

      Comment

      • Neo Geshel

        #4
        Re: Page_Load vs Submit_Click - which one first?

        Neo Geshel wrote:[color=blue]
        > Marina Levit [MVP] wrote:[color=green]
        >> Are you sure Submit_Click is attached as the Click event handler to a
        >> button? You didn't have a 'Handles Submit.Click' on there, I don't
        >> know if that is just an omission or if it's actually not there.
        >>
        >> Have you tried debugging into Submit_Click and seeing if it ever gets
        >> called?
        >>
        >> I suspect the handler is not being attached correctly.
        >>[/color]
        >
        > The handler is being attached correctly. I use the following:
        >
        > AddHandler submit.Click, AddressOf Submit_Click
        >
        > To connect the button to Submit_Click. The button is being attached to
        > the page in the following way:
        >
        > Dim preview As New Button()
        > myForm.Controls .Add(preview)
        > AddHandler submit.Click, AddressOf Submit_Click
        > preview.id = "preview"
        > preview.Text = "Preview News Article"
        >
        > TIA
        > ...Geshel[/color]

        Whoops... that kinda pointed out my problem, no?

        AddHandler *submit*.Click. ...
        *preview*.id = ...

        Thanks.
        ...Geshel
        --
        *************** *************** *************** *************** ***********
        * My reply-to is an automatically monitored spam honeypot. Do not use *
        * it unless you want to be blacklisted by SpamCop. Please reply to my *
        * first name at my last name dot org. *
        *************** *************** *************** *************** ***********
        * “I contend that we are both atheists. I just believe in one fewer *
        * god than you do. When you understand why you dismiss all the other *
        * possible gods, you will understand why I dismiss yours.” *
        * - Stephen F. Roberts *
        *************** *************** *************** *************** ***********
        * “Anyone who believes in Intelligent Design (“creationism ”) is just *
        * as ignorant, irrational and ill-educated as someone who believes *
        * that the world is a flat disc, that the Sun circles the Earth or *
        * that there really is a tooth fairy. Darwinism has an overwhelming *
        * foundation of evidence that can be tested and reproduced. *
        * *
        * “Intelligent Design, on the other hand, has no evidence at all;not *
        * one single shred of testable proof. As such, Intelligent Design is *
        * Religious Mythology, and has no right whatsoever to be in our *
        * Science classrooms.” - 99.99+% of Scientists *
        *************** *************** *************** *************** ***********
        Mignon McLaughlin once said that “A nymphomaniac is a woman [who is] as
        obsessed with sex as the average man.” Unfortunately, since true
        nymphomaniacs are so rare, this means that it takes an extraordinary
        woman to keep up with an ordinary man.
        *************** *************** *************** *************** ***********

        Comment

        Working...