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

Configure dropdownlist to show empty (blank ) option..

4 Answers 2246 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Wired_Nerve
Top achievements
Rank 2
Wired_Nerve asked on 06 Feb 2015, 10:05 PM
I have a dropdown list that is populated via ajax call.
Depending on what the user is allowed to do the dropdownlist might only have 1 item in it.
I need to add a empty option first, then append the ajax results.

I do this all the time in asp.net webform applications, how does one configure a kendoui dropdownlist to display the empty row but not allow it to be selectable?

4 Answers, 1 is accepted

Sort by
0
Wired_Nerve
Top achievements
Rank 2
answered on 06 Feb 2015, 10:21 PM
<div class="selectdiv">
    <select data-role="dropdownlist"
            data-option-label="{FundingSource:'Select...',FundingSourceUID:''}"
            data-value-primitive="true"
            id="fundingsouce"
            data-value-field="FundingSourceUID"
            data-text-field="FundingSource"
            data-bind=" source: fundingsoucedta"></select>
    <div class="fundingsouce"></div>
</div>
0
Wired_Nerve
Top achievements
Rank 2
answered on 07 Feb 2015, 05:08 PM
A quick note here.  The dropdown  list in the scenario that is causing me issues is when there is only one option for the user to select.  Basically, I click on the dropdown list and see only one option...  I click on it, and the change event does not fire...
0
Georgi Krustev
Telerik team
answered on 10 Feb 2015, 12:10 PM
Hi,

I tried to replicate the issue locally, but to no avail. Could you review the test Dojo demo and let me know if I am missing something? It will be very helpful if you can modify it in order to reproduce the issue.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Wired_Nerve
Top achievements
Rank 2
answered on 10 Feb 2015, 12:58 PM
I ended up adding a empty record to the dataset that is coming from the server and setting its value to -1.
Then in my code if the user selects that "blank" record I just prevent that selection.  I don't have time as of right now to dig deep into the dropdown control to figure out the exact problem.  
Tags
DropDownList
Asked by
Wired_Nerve
Top achievements
Rank 2
Answers by
Wired_Nerve
Top achievements
Rank 2
Georgi Krustev
Telerik team
Share this question
or