When is the best time to dynamically poulate a drop down box?

  • Thread starter Thread starter Simon Harvey
  • Start date Start date
S

Simon Harvey

Hi everyone,

I guess the subject says it all really. I'm not sure what event I should use
to populate a combobox that I've dragged onto the form.

Page_load, OnInit?

If its onInit, should my code be before or after what the form template has
put there?

Thanks everyone
Simon
 
Simon,

I dunno if it is the correct way but I always fill my comboboxes in the
Page_Load event.
There I check The Page.IsPostBack property to be false.
Since viewstate is basicaly always on in my case, I only need to populate
the comboboxes once.

Regards,

--

Nico Debeuckelaere

ND-Sign BVBA (Microsoft Certified Partner since 2004)
URL: http://www.nd-sign.com
== ND-Sign, Designed for you ==
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Hi Nico,

Thanks for your reply. Can you remind me why you check that the ispostback
is false? Is this (as I think you were saying in your post), to stop the
combo boxes being refilled?

Are the dynamic values loaded into the viewstate when the page loads th
first time?

Thanks again

Simon
 
Simon,

This is indeed the case.
Once you filled your combobox and you do a roundtrip to the server, your
combobox will still be filled because of the viewstate.

Regards,

--

Nico Debeuckelaere

ND-Sign BVBA (Microsoft Certified Partner since 2004)
URL: http://www.nd-sign.com
== ND-Sign, Designed for you ==
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top