PDA

View Full Version : [CLOSED] MultiSelect with Store



RajivDutt
Dec 17, 2013, 4:23 PM
With reference to the example on the given URL

http://mvc.ext.net/#/Form_MultiSelect/Overview/

Can you provide me some sample or code, where i can populate Multiselect from a model?

Baidaly
Dec 17, 2013, 7:06 PM
Hello!

You mean something like this:


@model List<Tuple<string, string>>
@{
ViewBag.Title = "Overview of MultiSelect - Ext.NET MVC Examples";
Layout = "~/Views/Shared/_BaseLayout.cshtml";
var X = Html.X();
}

@section example
{
@(X.Panel()
.Border(false)
.Width(300)
.Height(260)
.Layout(LayoutType.Fit)
.Items(
X.FieldSet()
.Title("With Legend")
.Layout(LayoutType.Fit)
.Items(
X.MultiSelect()
.Border(false)
.Items(i =>
{
foreach (var t in Model)
{
i.Add(new ListItem
{
Text = t.Item1,
Value = t.Item2
});
}
}
)
)
))
}


return View(new List<Tuple<string, string>>
{
new Tuple<string, string>("1", "1"),
new Tuple<string, string>("2", "2"),
new Tuple<string, string>("3", "3")
});

If you want to load data from model into the Store take a look at this example: http://mvc.ext.net/#/GridPanel_ArrayGrid/Simple/