0

Hi i am using kendo ui autocomplete but i am not getting the Value field in the server wrapper code. any help is greatly appriciated. if any alternative is there for this issue please suggest.

var comboBox = htmlHelper.Kendo().AutoComplete()
            .Name(tag + propertyName)
            .Value((propertyValue ?? ""))
            .DataTextField("Text")
            .HtmlAttributes(new { value = propertyValue })
            .DataSource(source =>
            {
                source.Read(read =>
                {
                    read.Action("Search", controller); //Set the Action and Controller name
                })
                .ServerFiltering(true);
            }).HighlightFirst(true).HtmlAttributes(htmlAttributes).Enable(!enabled.HasValue ? true : enabled.Value);
            //.Events(e => e.Change("function(e){ if(ComboOnChange(e)){" + onChange + "(e);} }")
            //.DataBound("function(e){ " + onBind + " }")).ToHtmlString();
        if(!String.IsNullOrEmpty( onChange))
        {
            comboBox.Events(e => e.Change("function(e){ if(ComboOnChange(e)){" + onChange + "(e);} }"));
        }
        if (!String.IsNullOrEmpty(onBind))
        {
            comboBox.Events(e => e.DataBound("function(e){ " + onBind + " }"));
        }
        var comboBoxData = comboBox.ToHtmlString();
        comboBoxData = comboBoxData.Replace("name=\"" + tag + propertyName + "\"", "name=\"" + propertyNameId + "\"");
        comboBoxData = comboBoxData.Replace("name=\"" + tag + propertyName + "-input\"", "name=\"" + propertyNameId + "\"");
Iman Mahmoudinasab
  • 6,861
  • 4
  • 44
  • 68
Rudresha Parameshappa
  • 3,826
  • 3
  • 25
  • 39

1 Answers1

0

This may be outdated, have you tried something like autocomplete[0].value?

ripsin
  • 273
  • 2
  • 7
  • 19