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

[Solved] Allow Custom Values After Binding

1 Answer 80 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Graham
Top achievements
Rank 2
Iron
Iron
Graham asked on 26 Feb 2013, 12:02 PM
The following code correctly allows selection of one of the previously used system names:

<%= Html.Telerik().ComboBoxFor(m => m.SystemName).BindTo(new SelectList(Model.SystemNameList, Model.SystemNameDefault)) %>

However - it doesn't allow entry of new (custom) values. What I want is:

1. show values already in database

2. default to the one already used

3. allow entry of a new value

I have features 1 and 2 above - but not 3. How can I allow for new entries, please?

1 Answer, 1 is accepted

Sort by
0
Graham
Top achievements
Rank 2
Iron
Iron
answered on 27 Feb 2013, 10:19 AM
As a workaround, I added a button to the form by the combobox which runs the following postback code:

if (newSystem != null) // "New System" button clicked - enable entry of a new system
{
    viewModel.SystemNameDefault = null;
    viewModel.SystemName = null;
}

Not great - but thankfully this web page is for internal use only, so our customers won't see it.
Tags
ComboBox
Asked by
Graham
Top achievements
Rank 2
Iron
Iron
Answers by
Graham
Top achievements
Rank 2
Iron
Iron
Share this question
or