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
495
Add a ListBar Dynamically Doesn't work
posted

I use this code to add a listbar

Dim ListBar As New Infragistics.WebUI.UltraWebListbar.UltraWebListbar

ListBar.Groups.Add("Pack")

ListBar.Groups.Add("Load")

ListBar.Groups.Add("Deliver")

 

_oCollection.Add(ListBar)

 

When this is added to the form I get javascript errors and the control doesn't work.  Its not collapsable.

Error 'Control.Events' is null or not an object

  • 28464
    posted

     Hello Chad,

    Yes, indeed, I was able to reproduce the very same javascript error while trying to programmatically add a UltraWebListbar instance to a placeholder. After scratching my head and trying different things for a good 15 minutes, it turned out that UltraWebLisbar expects you to explicitly set and ID in order to register its client-side instance using javascript. Now that I think about it, this actually makes sense, however I believe we should add an exception that explicitly asks for an ID, since the javascript error is indeed not descriptive at all.

    Here is my sample setup:

       <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
       
        protected void Page_Load(object sender, EventArgs e)
        {
            UltraWebListbar ultraWebListBar1 = new UltraWebListbar();


            ultraWebListBar1.ID = "ultraWebListBar1";
            ultraWebListBar1.Groups.Add(new Group("First Group"));
            ultraWebListBar1.Groups.Add(new Group("Second Group"));
            ultraWebListBar1.Groups.Add(new Group("Third Group"));

            PlaceHolder1.Controls.Add(ultraWebListBar1);    
        }

    Hope this helps.