frontend a duplicate multiselect element is created.

2 posts, 1 answers
  1. Sanjay
    Sanjay avatar
    11 posts
    Member since:
    Jul 2013

    Posted 10 Apr 2014 Link to this post

    Hi

    I have defined a multiselect element in my page. The I am trying to get the value of select items using javascript. When the .Value line is executed on the frontend a duplicate element is created.

    The pre and post image is attached.

    Please help

    Regards,
    Sanjay
    Definition
    @(Html.Kendo().MultiSelectFor(m => m.SeleFromAvail)                           
        .Name("seleLst")
           .Placeholder("Select")
           .HtmlAttributes(new { id = "seleLst", style = "width:940px;" })                           
           .BindTo((List<SelectListItem>)ViewBag.lstAvail)
           .Value((List<SelectListItem>)ViewBag.lstSele)
           .AutoClose(false)
           )
    Javascript       
    param = $("# seleLst ").kendoMultiSelect().data("kendoMultiSelect").value();
  2. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 11 Apr 2014 Link to this post

    Hello Sanjay,

    The widget is rendered twice, because the JavaScript code from your code snippet actually initialize the rendered widget for second time. If you need to retrieve the client instance of the widget then you will need to use this:
    param = $("# seleLst ").data("kendoMultiSelect").value();
    Find more information about how to retrieve the client instance here.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top