Delete DropDownList selected item

2 posts, 0 answers
  1. Larry
    Larry avatar
    11 posts
    Member since:
    Jul 2014

    Posted 08 Sep 2014 Link to this post

    I am using a DropDownList in a Grid.    I have nullable fields using the DropDownList.   I am having a problem deleting items that have been selected in the DropDownList.    Here is an example.    We have a nullable field for DepartmentID in a table and we have entered and saved data using the DropDownList.   Now we want to delete the DepartmentID field (or make it null again).   I have tried using the {delete} key, but that does not work.   I have tried trying to capture the {delete} key on the KeyPress in JavaScript and manually change the DepartmentID, but the {delete} key gets trapped before getting to my JavaScript so I cannot do it from JavaScript.    How do you reset the DepartmentID field back to Null?

    Thanks, Larry
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 10 Sep 2014 Link to this post

    Hello Larry,

    I am not sure I understand the scenario correctly. If you would like to change the value of some of the row's fields, then I would suggest passing the <tr> element to the Grid's dataItem method and then using the set method to modify it. For example: 
    var item = grid.dataItem(grid.tbody.find("tr:first")); //the first row;
    item.set("DepartmentID", null);

    Regards,
    Alexander Popov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top