473,320 Members | 2,122 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.

event firing

Hi,
In a class i built, i fire an event when a field changes. In a webform that
has an instance of the class, the event (from the class) is fired and the
code is executed. However, my webpage does not reload (postback) after the
event fires. How do i get the webform to postback when the event fires
(after the code in the event is done executing)?

Thank you,
Paul
Nov 18 '05 #1
8 1764
In order for an event to fire, a PostBack MUST occur, since the event
handler is on the server side. In other words,if your event handler is
firing, a PostBack IS occurring.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Paul" <NO**********@gotheta.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
Hi,
In a class i built, i fire an event when a field changes. In a webform that has an instance of the class, the event (from the class) is fired and the
code is executed. However, my webpage does not reload (postback) after the event fires. How do i get the webform to postback when the event fires
(after the code in the event is done executing)?

Thank you,
Paul

Nov 18 '05 #2
"Paul" <NO**********@gotheta.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
Hi,
In a class i built, i fire an event when a field changes. In a webform that has an instance of the class, the event (from the class) is fired and the
code is executed. However, my webpage does not reload (postback) after the event fires. How do i get the webform to postback when the event fires
(after the code in the event is done executing)?


Why would the form post back? Did you tell it to post back?

What are you trying to accomplish?
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #3
Oh.....ok....I see what you are saying. And you are correct, the page is
posting back. however, the bahavior i am trying to accomplish (I see that i
was not clear enough in my orginal post) is to have the event fire before
the page loads. Here is the sequence of events that appear to be happening.
(1) Data changes in class (2) call the event (3) Page_Load fires on webform
that containts the event code (4) event executes code

What i need to happen is
(1) same (2) same (3) event executes code then (4) Page_Load

See, in Page_Load, i need the data that is set in the event code.
Currently, when Page_Load runs, it has the previous data from my class.

Any ideas?

Thank you,
Paul
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
In order for an event to fire, a PostBack MUST occur, since the event
handler is on the server side. In other words,if your event handler is
firing, a PostBack IS occurring.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Paul" <NO**********@gotheta.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
Hi,
In a class i built, i fire an event when a field changes. In a webform

that
has an instance of the class, the event (from the class) is fired and the code is executed. However, my webpage does not reload (postback) after

the
event fires. How do i get the webform to postback when the event fires
(after the code in the event is done executing)?

Thank you,
Paul


Nov 18 '05 #4
"Paul" <NO**********@gotheta.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Oh.....ok....I see what you are saying. And you are correct, the page is
posting back. however, the bahavior i am trying to accomplish (I see that i was not clear enough in my orginal post) is to have the event fire before
the page loads. Here is the sequence of events that appear to be happening. (1) Data changes in class (2) call the event (3) Page_Load fires on webform that containts the event code (4) event executes code

What i need to happen is
(1) same (2) same (3) event executes code then (4) Page_Load

See, in Page_Load, i need the data that is set in the event code.
Currently, when Page_Load runs, it has the previous data from my class.
This is the way it's supposed to be. Instead of requiring the data in
Page_Load, use it when it's available, in the event.

If you have several events which determine the data you need to operate, you
can do some things in the PreRender event, when all of the PostBack events
and Data Change events will have fired.
--
John Saunders
johnwsaundersiii at hotmail

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
In order for an event to fire, a PostBack MUST occur, since the event
handler is on the server side. In other words,if your event handler is
firing, a PostBack IS occurring.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Paul" <NO**********@gotheta.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
Hi,
In a class i built, i fire an event when a field changes. In a webform
that
has an instance of the class, the event (from the class) is fired and the code is executed. However, my webpage does not reload (postback)
after the
event fires. How do i get the webform to postback when the event

fires (after the code in the event is done executing)?

Thank you,
Paul



Nov 18 '05 #5
PostBack events are always processed after the Load event. However, there
are other event handlers that occur AFTER the event handler fires
(Pre-Render, SaveViewState, Render, etc). I would suggest you put your code
into one of them, rather than Page_Load.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Paul" <NO**********@gotheta.com> wrote in message
news:#S**************@tk2msftngp13.phx.gbl...
Oh.....ok....I see what you are saying. And you are correct, the page is
posting back. however, the bahavior i am trying to accomplish (I see that i was not clear enough in my orginal post) is to have the event fire before
the page loads. Here is the sequence of events that appear to be happening. (1) Data changes in class (2) call the event (3) Page_Load fires on webform that containts the event code (4) event executes code

What i need to happen is
(1) same (2) same (3) event executes code then (4) Page_Load

See, in Page_Load, i need the data that is set in the event code.
Currently, when Page_Load runs, it has the previous data from my class.

Any ideas?

Thank you,
Paul
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
In order for an event to fire, a PostBack MUST occur, since the event
handler is on the server side. In other words,if your event handler is
firing, a PostBack IS occurring.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Paul" <NO**********@gotheta.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
Hi,
In a class i built, i fire an event when a field changes. In a webform
that
has an instance of the class, the event (from the class) is fired and the code is executed. However, my webpage does not reload (postback)
after the
event fires. How do i get the webform to postback when the event

fires (after the code in the event is done executing)?

Thank you,
Paul



Nov 18 '05 #6
Well I am using a Web Control. When something on the Web Control changes
(user changes data), i take the data from the control and use it in a class
that manages my data.
Actually, this is a little hard to explain so let me get more specific.

Here is an example of something very similar to what i am doing.

Lets say I have a TreeView on the left. The treeview containes car
information (All Makes of Cars and Models as children). When the user
changes the make or model, the data from the tree is synced with an object
that manages the information for all vehicles. When the page is rendered
again, after the new treenode is selected, i want to right had part of the
webform to display information about the current make/model. But i need to
get the information from the object and not the tree. So when the treenode
is changed, i make a change in the class, which fires an event on the
webform that will display information for the current make/model selected.

I am new to ASP .NET, so i may be going about this the wrong way anyway.
But my goal is to have the webform know what information is set in the
object before it renders; thus, the information must be set before
Page_Load.

I really hope this makes sense.

Thank you for your help.

My current delima is that the information is being update (via an event) for
the form after Page_Load fires. So when Page_Load fires, it has the
previous make/model selection (because the event that updates the data is
not fired until after Page_Load)
"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:e4*************@TK2MSFTNGP11.phx.gbl...
"Paul" <NO**********@gotheta.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
Hi,
In a class i built, i fire an event when a field changes. In a webform

that
has an instance of the class, the event (from the class) is fired and the code is executed. However, my webpage does not reload (postback) after

the
event fires. How do i get the webform to postback when the event fires
(after the code in the event is done executing)?


Why would the form post back? Did you tell it to post back?

What are you trying to accomplish?
--
John Saunders
johnwsaundersiii at hotmail

Nov 18 '05 #7
"Paul" <NO**********@gotheta.com> wrote in message
news:ua*************@tk2msftngp13.phx.gbl...
<snip>
I am new to ASP .NET, so i may be going about this the wrong way anyway.
But my goal is to have the webform know what information is set in the
object before it renders; thus, the information must be set before
Page_Load.


As you say, you're new to ASP.NET. Before you try to get ASP.NET to work
differently, you should first learn how it's meant to work.

I would recommend that you get a book on control development. I usually
recommend "Developing Microsoft® ASP.NET Server Controls and Components"
from Microsoft Press, by Nikhil Kothari and Vandana Datye
(http://www.microsoft.com/mspress/books/5728.asp). If you read it, you'll
learn how PostBack works and how PostBack Data events work.

They all happen after Page_Load.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #8
Well I definitely appreciate the advice John. PreRender ended up being my
ticket. I posted yesterday that the prerender had been the key and thank
you and Kevin for all of your help. But I don't see that it ever posted to
the newsgroup.

Thank you again for all of your help.

Paul

Anyway.....thanks again for your help and advice.
"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:eg**************@TK2MSFTNGP11.phx.gbl...
"Paul" <NO**********@gotheta.com> wrote in message
news:ua*************@tk2msftngp13.phx.gbl...
<snip>
I am new to ASP .NET, so i may be going about this the wrong way anyway.
But my goal is to have the webform know what information is set in the
object before it renders; thus, the information must be set before
Page_Load.


As you say, you're new to ASP.NET. Before you try to get ASP.NET to work
differently, you should first learn how it's meant to work.

I would recommend that you get a book on control development. I usually
recommend "Developing Microsoft® ASP.NET Server Controls and Components"
from Microsoft Press, by Nikhil Kothari and Vandana Datye
(http://www.microsoft.com/mspress/books/5728.asp). If you read it, you'll
learn how PostBack works and how PostBack Data events work.

They all happen after Page_Load.
--
John Saunders
johnwsaundersiii at hotmail

Nov 18 '05 #9

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

Similar topics

5
by: Steve M | last post by:
Why are my sessions lasting so long? I have them set to 20 minute timeout in config file? The Session_End event is getting called an hour or more sometimes--well after the user has stopped...
5
by: MS Newsgroups | last post by:
Hi, I have a scenario where I am dynamically adding a control from code when a controls event is fired. The problem I have is that when the newly created control is clicked, the click event does...
7
by: Shane Bishop | last post by:
I've been fighting with the Page_Load event firing twice. I looked through this user group and saw several other people having similar problems. There were various reasons for it:...
4
by: Larry Morris | last post by:
The following code, pasted into a web form with a link button on it, will cause the page_unload event to fire twice. If I remove the response.redirect, the problem goes away :). I've got a work...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
2
by: Dan | last post by:
I have an aspx page with a form on it. There are a couple of textboxes and an ImageButton. The page is loaded from another page using Server.Transfer. When I click on the ImageButton, the...
6
by: crk2 | last post by:
Here a simple one. (At least I think it is?) and any help would be truly appreciated. I have an inherited textbox on my form based on a custom texbox control. It looks something like this ...
0
by: hazz | last post by:
I would like to have control over datagridview events so that when a user 'single clicks' anywhere on the grid, a method call is made to a service and if a user 'double clicks' a Customer detail...
16
by: tommaso.gastaldi | last post by:
Hello, A probably dumb question... does anyone know hot to avoid that if one keep the mouse pressed on an arrow of the numericUpDown it continues to fire events (it uses evidently a timer) ?...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.