This is a migrated thread and some comments may be shown as answers.

Delete DropDownList selected item

1 Answer 47 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Larry
Top achievements
Rank 1
Larry asked on 08 Sep 2014, 10:40 PM
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

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 10 Sep 2014, 02:53 PM
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.

 
Tags
DropDownList
Asked by
Larry
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or