Home All Groups Group Topic Archive Search About

Page_Load vs Submit_Click - which one first?

Author
21 Mar 2006 7:46 PM
Neo Geshel
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.Text = "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(ltrlContent)
   ...
End Sub
Private Sub Submit_Click(...)
   ltrlContent.Text = "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.
***********************************************************************

Author
21 Mar 2006 7:57 PM
Marina Levit [MVP]
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" <got***@geshel.org> wrote in message
news:iKYTf.170058$B94.88432@pd7tw3no...
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.Text = "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(ltrlContent)
   ...
End Sub
Private Sub Submit_Click(...)
   ltrlContent.Text = "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.
***********************************************************************
Author
21 Mar 2006 8:36 PM
Neo Geshel
Marina Levit [MVP] wrote:
> 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.
>

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.
***********************************************************************
Author
21 Mar 2006 9:48 PM
Neo Geshel
Neo Geshel wrote:
Show quoteHide quote
> Marina Levit [MVP] wrote:
>> 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.
>>
>
> 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

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.
***********************************************************************