简体   繁体   中英

How do I have specific text appear when a selection is made under kendo UI Combo box?

I have a dropdownlist/combo box I made using Kendo UI for ASP .NET MVC4.

Now for each selection/choice I pick from the combo box, I want different text to appear for each choice. Eg Choice 1 (The text underneath the combo box should be word 1), for choice 2 (the text reads word 2), etc...

I'm assuming I have to create a div for each different text I want to put underneath it but I keep getting errors. I'm not sure how to proceed. An example would be nice.

Thank you.

EDIT:

I found a javascript example that illustrates what I mean:

Eg How would I take this example below and turn it around for Kendo UI? http://jsfiddle.net/b6ydm/

<script type="text/javascript">
function dropdownTip(value){
console.log(value);
    document.getElementById("result").innerHTML = value;
}</script>

<select onChange="dropdownTip(this.value)" name="search_type" style="margin-right:10px;    margin-top:2px;">
<option selected="selected" value="fruit_search">fruits</option>    
<option value="veggies_search">veggies</option>
<option value="animals_search">animals</option>
<option value="all_search">all</option>

Eg

<td>
  @(Html.Kendo().DropDownListFor(model => model.ViewModel.sType)
                      .HtmlAttributes(new {@class = "DropDown"})
                      .DataTextField("Text")
                      .DataValueField("Value")
                      .BindTo(Model.sList)
                      .Events(onselect => onselect.Change("ChangeEvent"))
                      )
                </td>
<span id="changingtext"></span>

function ChangeEvent(e){
   var value = this.value();
   // Use the value of the widget
   if( value == "choice1"){
        $('#changingtext').text("word1");
   }
}

I guess you could do something similiar like that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM