There are a number of ways to do this. If the menu items in the db don't
change frequently you can simply have a viewstate variable that is set once
the menu items are loaded. If the viewstate variable isn't there or is set
to true, you will know that the menu has been populated and doesn't need to
be re-populated. Of course, the simplest way is to just nuke the contents on
each load of the control but that is a performance hit on generation. What
you have sounds like it's working well, you just need to prevent it from
loading a new set of data every time the control is loaded.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
<do********************@communardo.dewrote in message
news:11**********************@s80g2000cwa.googlegr oups.com...
Hi,
I develop a sharepoint webpart with ASP.Net 2.0 and therefore override
CreateChildControls(). In CreateChildControls() I create dynamically a
menu with items (and sub items) from a database. Let's say after the
first loading I have 5 menu items.
My problem: Every time the page is loaded (that means also if a menu
item is clicked) the menu items are doubled (I have 10, 15, 20, ...
menu items).
How can I avoid this???
Any help is appreciated!
Dorrit