events fireing too many times?

G

Guest

Hi all,

I've designed a webform that has the following controls:

1. dropdown with autopostback
2. datagrid with an OnItemCreated event

The idea is that the dropdown defines a filter.

When I select a value in the drop down the following happends:

1. The page_init event is fired (OK)
2. The OnItemCreated event is fired (why dammit *** )
3. The Page_load event is fired (OK)
4. The Dropdown_SelectedIndexChanged event is fired ... (a bit late but ...)
5. The OnItemCreated event is fired (OK)

The problem is the first time the onItemCreated event is fired ... the
datasource is not (re)bound yet ..

Is this the intentional sequence of events or could I have done something to
disturb it?

Regards Jesper
 
K

Ken Cox [Microsoft MVP]

Hi Jesper,

Are you binding to the data on each postback? That would cause problems.

Ken

"Jesper Ordrup Christensen"
 
G

Guest

Hi Ken,

Short answer: no.

Longer one:

In the Page_Load event I do the !Page.ispostback() check.

But the data is an array of objects and if the user has selected another
data subset, then I need to bind a new array to the datagrid. I do this in
the Dropdown_SelectedIndexChanged event.

Jesper
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top