473,320 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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.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.
************************************************** *********************
Mar 21 '06 #1
3 1029
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" <go****@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.
************************************************** *********************
Mar 21 '06 #2
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 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.


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.
************************************************** *********************
Mar 21 '06 #3
Neo Geshel wrote:
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.
************************************************** *********************
Mar 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: z. f. | last post by:
Hi, i have a class that is derived from System.Web.UI.Page, and this is the class i use in my application as PageBase. all other page classes are deriverd from my PageBase instead of the...
5
by: Adam Clauss | last post by:
I have a webapp which consists of several different webforms. Basically: (1) view the contents of a database (2) one is to add a new entry (3) confirms the new entry. The third form, upon...
2
by: Skating_vince | last post by:
I have a problem, i have a form with some input boxes and a submit button. In the Submit_Click event, the data from the input boxes is stored in a database. But, if you click the button, ASP.NET...
2
by: Mark Rae | last post by:
I've inherited an ASP.NET app and have been asked to fix the following problem with a page which is used to display and/or delete records from a database. When the page loads, it displays a list of...
2
by: Dave | last post by:
Hi, this is a follow-up to an earlier question but I really haven't found a definitive answer in my search If I have a Base and Derived webform, I've found that the dervived Page_Load event...
4
by: tshad | last post by:
Is there a way to do put Page_loads on a page? I am trying to setup a Page_Load that just puts a persons name that is logged on at the top of a page the first time a page is loaded. In my...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
3
by: Neo Geshel | last post by:
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...
10
by: D. Shane Fowlkes | last post by:
I have a function that is called in page_load and the purpose of this function is to look up basic data in a MSSQL table and return it in the form of a datatable. The page_load will read the data...
17
by: Arpan | last post by:
When a Button is clicked in a Web Form in an ASPX page, the Form will post back to itself. Under such circumstances (i.e. when a Button is clicked), will the Page_Load sub execute first & then will...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.