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

Grid With DropdownList

1 Answer 673 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reafidy
Top achievements
Rank 1
Reafidy asked on 19 Oct 2017, 02:50 AM
I would like to allow a dropdownlist to show values that were previously selected but are now removed from the dropdownlist source.  Instead of displaying blank.  The dropdownlist is in a grid column.

Grid:
...
columns.ForeignKey(p => p.CurrentCategory, @Model.LookupCategory, "CategoryName", "CategoryName").Width(160);
...



Template editor
@using System.Collections
 
@(
 Html.Kendo().DropDownListFor(m => m)      
        .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
        .ValuePrimitive(true)       
        .AutoWidth(true)
)


So to explain in more detail:  The CurrentCategory column is a text column (not an id column) and the user can select from a list of items found in the LookupCategory.  However if an item is removed from the LookupCategory the value should still be displayed in instances where the user had already selected that value for the CurrentCategory.  

Currently if a row contains a CurrentCategory value that is not in the LookupCategory list it is displayed as blank.

Perhaps I have to use a combobox instead? 

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 23 Oct 2017, 10:23 AM
Hi,

The DropDownList component can show items from a predefined list. If the value in the column is not present in the data that is bound to the DropDownList then the value will not be displayed. 

In case you would like to enable the users to enter values that are not in the predefined list of options I can suggest using a ComboBox component. It allows free text to be entered. 



Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Reafidy
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or