I found the following code example (from Telerik ) that I’m trying to understand.
What I need to do is somehow to set static text into JsonResult (e.g.Text =”Abc” and Value=”123″)
public ActionResult _AjaxLoading(string text)
{
Thread.Sleep(1000);
using ( var nw = new NorthwindDataContext() )
{
var products = nw.Products.AsQueryable();
if ( text.HasValue() )
{
products = products.Where((p) => p.ProductName.StartsWith(text));
}
return new JsonResult { Data = new SelectList(products.ToList(), "ProductID", "ProductName") };
}
}
Is this what you are looking for
If you want to add a new element to the drop down at start then