473,406 Members | 2,705 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,406 software developers and data experts.

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.EventArgs) Handles MyBase.Load
End Sub

This function will be load first, followed by

Private Sub Submit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) 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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Submit.Click
displaytablefromdatabase()
End Sub

Also, i have to put the displaytablefromdatabase() 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.EventArgs) Handles MyBase.Load
If me.ispostback() then
displaytablefromdatabase()
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
displaytablefromdatabase() and display the form. before the form goes to
"Reset_Click" function.

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

What can i do?

Thanks all

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

Please clarify.
"Harry" <ha******@mail.hongkong.com> wrote in message
news:Oj*************@TK2MSFTNGP12.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.EventArgs) Handles MyBase.Load
End Sub

This function will be load first, followed by

Private Sub Submit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) 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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Submit.Click
displaytablefromdatabase()
End Sub

Also, i have to put the displaytablefromdatabase() 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.EventArgs) Handles MyBase.Load
If me.ispostback() then
displaytablefromdatabase()
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
displaytablefromdatabase() and display the form. before the form goes to
"Reset_Click" function.

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

What can i do?

Thanks all

Regards,
Harry

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

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

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

"William F. Robertson, Jr." <wf*********@kpmg.com> wrote in message
news:Op*************@TK2MSFTNGP11.phx.gbl...
If you have a !Page.IsPostBack in your page load. I don't know how the
displaytablefromdatabase() is running before the Reset_Click method (event).
Please clarify.
"Harry" <ha******@mail.hongkong.com> wrote in message
news:Oj*************@TK2MSFTNGP12.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.EventArgs) Handles MyBase.Load
End Sub

This function will be load first, followed by

Private Sub Submit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) 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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Submit.Click
displaytablefromdatabase()
End Sub

Also, i have to put the displaytablefromdatabase() 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.EventArgs) Handles MyBase.Load
If me.ispostback() then
displaytablefromdatabase()
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
displaytablefromdatabase() and display the form. before the form goes to
"Reset_Click" function.

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

to
the "Reset_Click" 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.OnPreRender()

c# code
protected override void OnPreRender( EventArgs e )
{
DisplayTableFromDataBase();
base.OnPreRender( 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****************@TK2MSFTNGP10.phx.gbl...
the displaytablefromdatabase() has been put in

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

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

"William F. Robertson, Jr." <wf*********@kpmg.com> wrote in message
news:Op*************@TK2MSFTNGP11.phx.gbl...
If you have a !Page.IsPostBack in your page load. I don't know how the
displaytablefromdatabase() is running before the Reset_Click method (event).

Please clarify.
"Harry" <ha******@mail.hongkong.com> wrote in message
news:Oj*************@TK2MSFTNGP12.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.EventArgs) Handles MyBase.Load
End Sub

This function will be load first, followed by

Private Sub Submit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) 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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Submit.Click
displaytablefromdatabase()
End Sub

Also, i have to put the displaytablefromdatabase() 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.EventArgs) Handles MyBase.Load
If me.ispostback() then
displaytablefromdatabase()
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
displaytablefromdatabase() and display the form. before the form goes
to "Reset_Click" function.

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

go to
the "Reset_Click" 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
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. ...
2
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...
1
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...
0
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
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...
2
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...
1
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...
12
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...
1
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.