Kendo UI Fügen Sie Dropdownlist in Grid (MVC) hinzuJquery

JQuery-Programmierung
Anonymous
 Kendo UI Fügen Sie Dropdownlist in Grid (MVC) hinzu

Post by Anonymous »

Ich bin bindend an eine Gitterklasse (userId, FirstName, LastName, Choice).

Code: Select all

@(Html.Kendo().DropDownList()
.Name("Test")
.DataTextField("Text")
.DataValueField("Value")
.Events(e => e.Change("change"))
.BindTo(new List()
{
new SelectListItem()
{
Text = "Option1",
Value = "1"
},
new SelectListItem()
{
Text = "Option2",
Value = "2"
}
}))

function change() {
var value = $("#Choice").val();
}

< /code>
....
columns.Bound(p=> p.FirsName);
columns.Bound(p => p.LastName);
//How to Bind Choice???
< /code>
Ich brauche auch einen Text ("option1" oder "option2") im Backend -Code.
irgendwelche Lösungen? columns.Bound(p => p.Choice).ClientTemplate("#=Choice#");
< /code>
Controller: < /p>
public ActionResult Index()
{
PopulateCategories();
return View();
}

< /code>
....
 private void PopulateCategories()
{
var dataContext = new TestDB();
var categories = dataContext.Peoples
.Select(c => new People()
{
ChoiceID = c.ChoiceID,
Choice = c.Choice
})
.OrderBy(e => e.Choice);
ViewData["categories"] = categories;
ViewData["defaultCategory"] = categories.First();
}

Aber das funktioniert nicht ...

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post