Aug 26, 2010, 11:04 AM
Link combo box problem!!!!!!!!!!!!!!!!!!!!!!
Hi all,
I want to use link combo box but it have any problems. I spend too much my time but don't resolve it.
Please get my sample project http://www.4shared.com/file/Bxg-u5Up/WebSites.html , it have 3 folders:
1. Data folder: contains the script to create database (sql 2008)
2. Web site folder: contains the UI code
3. Lib folder: contains some dll reference file.
or see following code:
HTML code:
1. i want to reload the second combo box when the first combo box is selected.
2. can i use the paging for my combo box ???
Regards,
Huy
I want to use link combo box but it have any problems. I spend too much my time but don't resolve it.
Please get my sample project http://www.4shared.com/file/Bxg-u5Up/WebSites.html , it have 3 folders:
1. Data folder: contains the script to create database (sql 2008)
2. Web site folder: contains the UI code
3. Lib folder: contains some dll reference file.
or see following code:
HTML code:
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html>
<head>
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:ComboBox ID="cboCountry" runat="server" Width="200" FieldLabel="Quốc gia" DisplayField="Name"
ValueField="ID" TypeAhead="true" Mode="Local" Editable="true" ForceSelection="true"
TriggerAction="All" EmptyText="Chọn quốc gia" SelectOnFocus="true" LabelSeparator="<font color=red>*</font>"
LoadingText="Đang tải dữ liệu ...">
<Store>
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:JsonReader IDProperty="ID">
<Fields>
<ext:RecordField Name="ID" />
<ext:RecordField Name="Code" />
<ext:RecordField Name="Name" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<Template ID="Template1" runat="server">
<Html>
<tpl for=".">
<div class="x-combo-list-item">{Code:htmlEncode} - {Name:htmlEncode}</div>
</tpl>
</Html>
</Template>
<Triggers>
<ext:FieldTrigger Icon="Clear" HideTrigger="true" Qtip="Bỏ chọn" />
</Triggers>
<Listeners>
<Select Handler="this.triggers[0].show();" />
<BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
<TriggerClick Handler="if (index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
</Listeners>
<DirectEvents>
<Select OnEvent="OnCountrySelect">
</Select>
</DirectEvents>
</ext:ComboBox>
<ext:ComboBox ID="cboCity" runat="server" Width="200" FieldLabel="Tỉnh thành" DisplayField="DisplayName"
ValueField="ID" TypeAhead="true" Mode="Local" Editable="true" ForceSelection="true"
TriggerAction="All" EmptyText="Chọn tỉnh, thành" SelectOnFocus="true" LabelSeparator="<font color=red>*</font>"
LoadingText="Đang tải dữ liệu ...">
<Store>
<ext:Store ID="storeCity" runat="server">
<Reader>
<ext:JsonReader IDProperty="ID">
<Fields>
<ext:RecordField Name="ID" />
<ext:RecordField Name="Name" />
<ext:RecordField Name="DisplayName" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<Template ID="Template2" runat="server">
<Html>
<tpl for=".">
<div class="x-combo-list-item">{Name:htmlEncode} - {DisplayName:htmlEncode}</div>
</tpl>
</Html>
</Template>
<Triggers>
<ext:FieldTrigger Icon="Clear" HideTrigger="true" Qtip="Bỏ chọn" />
</Triggers>
<Listeners>
<Select Handler="this.triggers[0].show();" />
<BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
<TriggerClick Handler="if (index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
</Listeners>
</ext:ComboBox>
</form>
</body>
</html>
and behind code:protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
var systemConfigService = ServiceFacade.CreateSystemConfigService();
var catalogService = ServiceFacade.CreateCatalogService();
var cityService = ServiceFacade.CreateCityService();
var countries =
(List<Catalog>) catalogService.GetCatalogByTypeDisplayOrder((int) Constants.CatalogType.National).Source;
var storeCountry = cboCountry.Store.Primary;
storeCountry.DataSource = countries;
storeCountry.DataBind();
var selectedCountryId = ((Catalog)
catalogService.GetCatalogByCode(
systemConfigService.GetByKey(Constants.SystemConfigKey.DEFAULT_NATIONAL))
.Source).ID;
cboCountry.SelectedItem.Value = selectedCountryId.ToString();
var cities = (List<City>) cityService.GetByCountry(selectedCountryId).Source;
var storeCity = cboCity.Store.Primary;
storeCity.DataSource = cities;
storeCity.DataBind();
}
}
protected void OnCountrySelect(object sender, DirectEventArgs e)
{
var cityService = ServiceFacade.CreateCityService();
var cities = (List<City>)cityService.GetByCountry(new Guid(cboCountry.SelectedItem.Value)).Source;
var storeCity = cboCity.Store.Primary;
storeCity.DataSource = cities;
storeCity.DataBind();
}
My problem is: 1. i want to reload the second combo box when the first combo box is selected.
2. can i use the paging for my combo box ???
Regards,
Huy