1 selected ites send 2 values in selectedValue

5 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 31 May Link to this post

    I have a DDT binding server side to Id & Name, I also have checkboxes

    rdtLocation.DataSource = locations;
    rdtLocation.DataTextField = "Name";
    rdtLocation.DataFieldID = "Id";
    rdtLocation.DataValueField = "Id";
    rdtLocation.DataFieldParentID = "ParentId";
    rdtLocation.DataSource = locations;
    rdtLocation.DataBind();

    With one selected item when I look at the selectedValue I get a comma separated list containing 2 instances of the id. ie - "2,2"

    See attached screen shot.

    Why is this and what is the fix.

    Andy

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1803 posts

    Posted 02 Jun Link to this post

    Hello Andy,

    I have tested different scenarios, but I was not able to replicate the issue with two duplicate ID values. Can you please provide some dummy data that replicates the issue and also the exact steps for reproducing it?

    I am looking forward to your reply.


    Regards,
    Konstantin Dikov
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 03 Jun Link to this post

    For now I have a fix for this, using LINQ to select distinct.

    var location = rdtLocation.SelectedValue.Split(',').Select(int.Parse).Distinct().ToList();

    ANdy

  5. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 06 Jul Link to this post

    Hi, I need to revisit this.

    What I'm finding is that if I change selections, I get both in the SelectedValue, so no I cant use the LINQ above, as the ID's are different. I read somewhere that the control has to be Ajaxified to stop this but cant find it now.

    Any ideas?

    Andy

  6. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 11 Jul Link to this post

    Hello Andy,

    I'm sending a sample web site to demonstrate that the SelectedValue should correctly return only the values of the checked items single time. Alternatively, you can traverse the RadDropDownTree1.EmbeddedTree.CheckedNodes collection and extract the values manually.

    I hope this will prove helpful.

    Regards,
    Eyup
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017