473,782 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question about the events in the webform control

Dear all,

It is found that when a webform control trigger an event,

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
End Sub

This function will be load first, followed by

Private Sub Submit_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Submit.Click
End Sub

the click event of button.

I have to generate a table from the database table.

I found that the generation of table function should put in submit_click
function

Private Sub Submit_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Submit.Click
displaytablefro mdatabase()
End Sub

Also, i have to put the displaytablefro mdatabase() function page_load as i
have to deal with the postback when the page is refreshed.

Thus, i added something in Page_load

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If me.ispostback() then
displaytablefro mdatabase()
end if
End Sub
The problem is that, i have another button called "reset", if a user click
"reset" button, the textbox in the form is set to empty string.

however, each time the "reset" button has been click, it will autopost back
and go to the "Page_Load" function and execute the
displaytablefro mdatabase() and display the form. before the form goes to
"Reset_Clic k" function.

Clearly, i don't want to execute displaytablefro mdatabase() when i click
Reset button. But, the webform has to go to Page_Load function before go to
the "Reset_Clic k" function.

What can i do?

Thanks all

Regards,
Harry
Nov 18 '05 #1
3 1232
If you have a !Page.IsPostBac k in your page load. I don't know how the
displaytablefro mdatabase() is running before the Reset_Click method (event).

Please clarify.
"Harry" <ha******@mail. hongkong.com> wrote in message
news:Oj******** *****@TK2MSFTNG P12.phx.gbl...
Dear all,

It is found that when a webform control trigger an event,

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
End Sub

This function will be load first, followed by

Private Sub Submit_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Submit.Click
End Sub

the click event of button.

I have to generate a table from the database table.

I found that the generation of table function should put in submit_click
function

Private Sub Submit_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Submit.Click
displaytablefro mdatabase()
End Sub

Also, i have to put the displaytablefro mdatabase() function page_load as i
have to deal with the postback when the page is refreshed.

Thus, i added something in Page_load

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If me.ispostback() then
displaytablefro mdatabase()
end if
End Sub
The problem is that, i have another button called "reset", if a user click
"reset" button, the textbox in the form is set to empty string.

however, each time the "reset" button has been click, it will autopost back and go to the "Page_Load" function and execute the
displaytablefro mdatabase() and display the form. before the form goes to
"Reset_Clic k" function.

Clearly, i don't want to execute displaytablefro mdatabase() when i click
Reset button. But, the webform has to go to Page_Load function before go to the "Reset_Clic k" function.

What can i do?

Thanks all

Regards,
Harry

Nov 18 '05 #2
the displaytablefro mdatabase() has been put in

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If me.ispostback() then // if it is
post back, displaytablefro mdatabase() will be runned
displaytablefro mdatabase()
end if
End Sub

if i don't execute displaytablefro mdatabase() when whenever it post back,
the table will disappeared when the page is post back.

"William F. Robertson, Jr." <wf*********@kp mg.com> wrote in message
news:Op******** *****@TK2MSFTNG P11.phx.gbl...
If you have a !Page.IsPostBac k in your page load. I don't know how the
displaytablefro mdatabase() is running before the Reset_Click method (event).
Please clarify.
"Harry" <ha******@mail. hongkong.com> wrote in message
news:Oj******** *****@TK2MSFTNG P12.phx.gbl...
Dear all,

It is found that when a webform control trigger an event,

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
End Sub

This function will be load first, followed by

Private Sub Submit_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Submit.Click
End Sub

the click event of button.

I have to generate a table from the database table.

I found that the generation of table function should put in submit_click
function

Private Sub Submit_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Submit.Click
displaytablefro mdatabase()
End Sub

Also, i have to put the displaytablefro mdatabase() function page_load as i have to deal with the postback when the page is refreshed.

Thus, i added something in Page_load

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If me.ispostback() then
displaytablefro mdatabase()
end if
End Sub
The problem is that, i have another button called "reset", if a user click "reset" button, the textbox in the form is set to empty string.

however, each time the "reset" button has been click, it will autopost

back
and go to the "Page_Load" function and execute the
displaytablefro mdatabase() and display the form. before the form goes to
"Reset_Clic k" function.

Clearly, i don't want to execute displaytablefro mdatabase() when i click
Reset button. But, the webform has to go to Page_Load function before go

to
the "Reset_Clic k" function.

What can i do?

Thanks all

Regards,
Harry


Nov 18 '05 #3
I don't know how safe this is (I am sure it is plenty safe), but it is what
I started doing for this situation.

override the OnPreRender event for the page and before calling
myBase.OnPreRen der()

c# code
protected override void OnPreRender( EventArgs e )
{
DisplayTableFro mDataBase();
base.OnPreRende r( e );
}

The display table will always run after the page_load and any postback
events have fired.

bill

"Harry" <ha******@mail. hongkong.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
the displaytablefro mdatabase() has been put in

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If me.ispostback() then // if it is post back, displaytablefro mdatabase() will be runned
displaytablefro mdatabase()
end if
End Sub

if i don't execute displaytablefro mdatabase() when whenever it post back,
the table will disappeared when the page is post back.

"William F. Robertson, Jr." <wf*********@kp mg.com> wrote in message
news:Op******** *****@TK2MSFTNG P11.phx.gbl...
If you have a !Page.IsPostBac k in your page load. I don't know how the
displaytablefro mdatabase() is running before the Reset_Click method (event).

Please clarify.
"Harry" <ha******@mail. hongkong.com> wrote in message
news:Oj******** *****@TK2MSFTNG P12.phx.gbl...
Dear all,

It is found that when a webform control trigger an event,

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
End Sub

This function will be load first, followed by

Private Sub Submit_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Submit.Click
End Sub

the click event of button.

I have to generate a table from the database table.

I found that the generation of table function should put in submit_click function

Private Sub Submit_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles Submit.Click
displaytablefro mdatabase()
End Sub

Also, i have to put the displaytablefro mdatabase() function page_load as i
have to deal with the postback when the page is refreshed.

Thus, i added something in Page_load

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If me.ispostback() then
displaytablefro mdatabase()
end if
End Sub
The problem is that, i have another button called "reset", if a user click "reset" button, the textbox in the form is set to empty string.

however, each time the "reset" button has been click, it will autopost

back
and go to the "Page_Load" function and execute the
displaytablefro mdatabase() and display the form. before the form goes
to "Reset_Clic k" function.

Clearly, i don't want to execute displaytablefro mdatabase() when i click Reset button. But, the webform has to go to Page_Load function before

go to
the "Reset_Clic k" function.

What can i do?

Thanks all

Regards,
Harry



Nov 18 '05 #4

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

Similar topics

1
1740
by: Keith Harris | last post by:
Hi, I have a Repeater control which is bound to a dataset. In the footer of the repeater control, I have a Button whose visibility I want to vary according to the sum of a column being > 0. I have tried to set the button's visibility in Page_Load (after data binding), but I get a NullReferenceException stating that "Object reference not set to an instance of an object".
2
8403
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
1
2008
by: hybrid | last post by:
I have problems in understanding the behavior of the events triggered by dynamically created controls over a webform. Could you help me? In a webform, I have a static PlaceHolder PH containing a table of controls, dynamically generated. Among these, a linkbutton (LinkBtn) to which have attached a click handler method, LinkBtn_Click(...) . Generally it works fine, but if in the LinkBtn_Click(...) code I try to access a webform control,...
0
1112
by: Kevin Ortman | last post by:
Hi all, I am wondering if the following is a known problem, and if there are any known solutions. Thanks in advance, Kevin Ortman
5
1466
by: Xaviero | last post by:
I have a webform that contains a placeholder control that is filled with various usercontrols. I have an error/info message label on the webform (for interface clenliness). Sometimes the the usercontrol has to populate the message label on the webform. How can I have the webfrom respond to this type of request from the user control? Thanks
2
1395
by: Craig Douthitt via DotNetMonster.com | last post by:
I am trying to capture an buttonclick on a usercontrol in the webform the usercontrol resides in. After researching this issue, I've come to believe that the best way of handling this is by raising an event in the control and consuming the event in the webform. I tried the following, unfortunatly while the usercontrol raises the event the webform method does not react. UserControl (Named WebUserControl1 contains one button) Public...
1
925
by: serge calderara | last post by:
Dear all, I have a webform on which I have place a text box server control and bellow a button server control. Both of those controls are set with cache events. based on that on webform load event I have a default text value like "Enter something here.." in text box control Then when the button is clicked, I need to retrieve the value of the tex box when chage by the user. I have read that cach events occurs in the order of
12
2807
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown when menu items are clicked.Besides these i would like to put a custom status bar. Any error message encountered in any of the webpage will be displayed in the banner. The problem iam encountering is how to access the customer status bar in child...
1
1164
by: jlw | last post by:
Hello all, I have a strange one here. in VS.NET VB web application, I can create a webform, place server controls on it, run it, and server controls fire all the right events in the postback routines. I create a simple usercontrol with one button, drag it onto the webform, none of the events in the usercontrol get trapped in the code behind segements.
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10076
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.