0
votes

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 + "\"");
1
how you are trying to get the value ? - Jidheesh Rajan
Please post your code only then we can comment. - ckv
i have added the code - Rudresha Parameshappa
Why are you overriding the name of the combobox so brutally? What is the target value and why you are not relying on setting it via Name() - Atanas Korchev
actually i am implementing this one for the framework. its not giving any problem. the only problem Kendo autocomplete not providing DataValue field. - Rudresha Parameshappa

1 Answers

0
votes

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