Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am new to mvc kendo ui i used kendoautocomplete and able to get the list when i typed in the textbox. here is my razor code

XML
<div>
   @(Html.Kendo().AutoComplete()
              .Name("CPT")
              .DataTextField("cptcode")
              .Filter(FilterType.StartsWith)
              .DataSource(source =>
              {
                  source.Read(read =>
                  {
                      read.Action("GetCpt", "TransactionDetail").Data("onAdditionalData");
                  })
                  .ServerFiltering(true);
              })
      )
</div>

and in controller the method is
C#
public JsonResult GetCpt(string text)
{
    List<cptmaster> cptlist = new List<cptmaster>();
    var cptcodelist = db.cptmasters.Select(a => new cptmaster { cptcode= a.cptcode, mod1= a.mod1  }).ToList();
    if (!string.IsNullOrEmpty(text))
    {
        cptcodelist = cptcodelist.Where(a => a.cptcode.StartsWith(text)).ToList();
    }

    return Json(cptcodelist, JsonRequestBehavior.AllowGet);
}

I want to save data to the database and how to get the selected text from the autocomplete textbox i tried select event but couldnt get the value. Thanks in advance for help.
Posted
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900