Select nothing in multiselect causes error

3 posts, 1 answers
  1. ManniAT
    ManniAT avatar
    885 posts
    Member since:
    Nov 2003

    Posted 23 Jul 2015 Link to this post


    I use a MultiSelect to choose several values in an m:n relation.

    Everything works as expected as long as I select one or more values.
    But when I select nothing I get the following error:

    0x800a138f - Laufzeitfehler in JavaScript: Die Eigenschaft "length" eines undefinierten oder Nullverweises kann nicht abgerufen werden.

    The failing code is for(n=0,i=e.length;i>n;n++)o+=n%2?s(e[n]):a(e[n]),r._data.push(e[n]);return o}

    This happens only when I add a new record.
    If I edit an existing one it is possible to remove the formerly chosen element and update after this.

    I initialize the field via model.Field(p => p.Salads).DefaultValue(new List<EECanteen.Models.FoodItem>());

    To explain my problem - I want to edit meal offerings for a day and can choose from zero or more salads.

  2. Answer
    Alexander Popov
    Alexander Popov avatar
    1436 posts

    Posted 27 Jul 2015 Link to this post

    Hello ManniAT,

    I am not sure how the Grid is configured and when exactly the error occurs. Would you please share some code snippets, or ideally - a runnable sample that we can examine?

    Alexander Popov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. ManniAT
    ManniAT avatar
    885 posts
    Member since:
    Nov 2003

    Posted 27 Jul 2015 in reply to Alexander Popov Link to this post

    I found the problem - it was created by a C# (model) class which was missing the creation of a list in the constructor.

    Thank you


Back to Top