Select options added server side rendering as undefined


I’m writing an app with the scheduler for ASP.NET in VB.NET
Here’s the server side code for a lightbox select that I’m adding. The options are pulled from the db and into an iEnumerable of lightboxSelectionOption by the shared helper method in the code block bellow.

        Dim ddlLocation As LightboxSelect = New LightboxSelect("offLocations", "Office Location")
        ddlLocation.MapTo = "location"
        ddlLocation.Height = 30

When I run the app, the options in the select have “undefined” as their keys and labels. It works when the options are added separately with the AddOption() method, but not the method the takes an enumerable of options.



I’ve confirmed the bug, I also get undefined list items when options are added using AddOptions method, using LightboxSelectOption items.

The issue happens only when you use an IEnumerable of LightboxSelectOption objects, options are loaded correctly if you pass them using anonymous classes:
So workaround is to use anonymous classes for options collection:


var select = new LightboxSelect("offLocations", "AddOptions AnonymousClass");
select.MapTo = "location";
select.Height = 30;

select.AddOptions(new List<object>
     new {key = 1, label = "first" },
     new {key = 2, label = "second" }

    Dim select2 = New LightboxSelect("offLocations", "AddOptions AnonymousClass")
    select2.MapTo = "location"
    select2.Height = 30
    select2.AddOptions(New List(Of Object) From {
        New With {Key
            .key = 1, Key
            .label = "first"
        New With {Key
            .key = 2, Key
            .label = "second"