Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
Add Groups and Items on Custom Event?
posted

Hello,

my WebExplorerBar gets its Groups and Items in an Event:

 

protected void Page_Load(object sender, EventArgs e)
{
    XXX.NavigationUpdate += new NavigationUpdateEventHandler(Navigation_NavigationUpdate);
}

void Navigation_NavigationUpdate(object sender, NavigationEventArgs e)
{
    UpdateNavigation(e.Key);
}

protected void UpdateNavigation(String key)
        {
            foreach (...yyy...)
            {
                ExplorerBarGroup explorerBarGroup = new ExplorerBarGroup();
                explorerBarGroup.Text = yyy.Key;
                explorerBarGroup.Value = yyy.Value;
                WebExplorerBarDisplayGroup.Groups.Add(explorerBarGroup);
            }

            (...)

        }

The Groups and Items are created in UpdateNavigation() and also added to the WebExplorerBar there.

But they look strange (A look into HTML shows: div and span are missing below the "igeb_XXXHolder level, different class names used than normal; The Groups are <li><a> instead of <li><div><a><span>)

Important: Everything works and looks fine if i add the groups and items not in the event handler but in an earlier point in control lifecycle (say Onload)! But I have to react on the event somehow, so using onload for Item addition is not possible! I suppose there is some initialisation going on before the event handler does its work which needs the existence of the groups and items? Can this initialization be done afterwards too?

I hope you understand my problem, otherwise ask please. Thanks in Adcance!

 

 

  • 170
    posted

    So I think I have it now: Creating the control completely dynamically on the event does the trick.