Oct 10, 2012, 3:07 PM
hi,
please mark as closed.
please mark as closed.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.MultiCombo1.GetStore();
store.DataSource = new object[]
{
new object[] { ResourceManager.GetIconClassName(Icon.FlagFr), "France"},
new object[] { ResourceManager.GetIconClassName(Icon.FlagCa), "Canada"},
new object[] { ResourceManager.GetIconClassName(Icon.FlagDe), "Germany"},
new object[] { ResourceManager.GetIconClassName(Icon.FlagUs), "United States"},
new object[] { ResourceManager.GetIconClassName(Icon.FlagIt), "Italy"}
};
store.DataBind();
ResourceManager1.RegisterIcon(Icon.FlagFr);
ResourceManager1.RegisterIcon(Icon.FlagCa);
ResourceManager1.RegisterIcon(Icon.FlagDe);
ResourceManager1.RegisterIcon(Icon.FlagUs);
ResourceManager1.RegisterIcon(Icon.FlagIt);
}
}
</script>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
<style type="text/css">
.icon-combo-item {
background-repeat: no-repeat ! important;
background-position: 3px 50% ! important;
padding-left: 24px ! important;
}
</style>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:MultiCombo
ID="MultiCombo1"
runat="server"
Width="250"
DisplayField="name"
QueryMode="Local"
EmptyText="Select countries...">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="iconCls" />
<ext:ModelField Name="name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ListConfig runat="server">
<ItemTpl runat="server">
<Html>
<div class="x-combo-list-item {[this.getItemClass(values)]}">
<div class="x-mcombo-text icon-combo-item {iconCls}">{name}</div>
</div>
</Html>
</ItemTpl>
</ListConfig>
</ext:MultiCombo>
</body>
</html>
protected object ColorGroups
{
get { return ctx.ColorGroups.Select(c => new object[] { c.id, "#" + c.Color, c.ColorName }); }
}
<ext:MultiCombo runat="server" FieldLabel="COLOR GROUP" ID="COLOR_GROUP" ValueField="id"
DisplayField="ColorName" QueryMode="Local">
<Store>
<ext:Store runat="server" Data="<%# ColorGroups %>">
<Model>
<ext:Model runat="server" IDProperty="id">
<Fields>
<ext:ModelField Name="id" />
<ext:ModelField Name="Color" />
<ext:ModelField Name="ColorName" />
</Fields>
</ext:Model>
</Model>
<Reader>
<ext:ArrayReader IDProperty="id" />
</Reader>
</ext:Store>
</Store>
<Listeners>
<BeforeRender Handler="this.getPicker().tpl.html =
'<ul>'+
'<tpl for=".">'+
'<li role="option" class="x-boundlist-item">'+
'<div class="x-combo-list-item {[this.getItemClass(values)]}">'+
'<div class="x-mcombo-text">'+
'<span style="background:{Color}; border: solid 1px silver;"> </span> {ColorName}'+
'</div>'+
'</div>'+
'</li>'+
'</tpl>'+
'</ul>';" />
</Listeners>
</ext:MultiCombo>