Click to See Complete Forum and Search --> : Control


Joschua
July 11th, 2003, 06:00 PM
Hi

I have a file.aspx with a some controls (i.e. listbox, texbox..)
and I create Method for the OnSelectedIndexChanged.
Its driven ok.

Now I have create a programmaticly custom control which
include a Calender control and a ListBox and a Button and
include it in the file.aspx.

To fillup the ListBox I use data from a Database. I create a
Method InitData() in the custom control. In the Method
CreateChildControls(), I create the controls and add the
eventhandlers for the calendar and button control.
Now, when I change the item and its call the
OnSelectedIndexChanged,I have to change the data from
the DB in the custom control. that must happen befor the
control call the CreateChildControls().


The load of the page is successfull. Now the prolbem: when I
change the item in the Listbox, the methods ar calling in the
following oder :

1. custom_control_constructor()
2. OnInit(EventArgs e)
3. the OnSelectedIndexChanged method
4. CreateChildControls()

and this ist the successfull way. now when I change to a other
item in the listbox I have the follow method order

1. custom_control_constructor()
2. OnInit(EventArgs e)
3. CreateChildControls()
4. the OnSelectedIndexChanged method

AND this ist WRONG. But i don't know why, because I can switch
between the items and the same effect occours.

thnx a lot for your help