前台页面代码
<ext:ComboBox ID="getYear" runat="server" Width="150" FieldLabel="年度" EmptyText="请选择..." Editable="false">
<Listeners>
<Change Handler="highYear.setValue(getYear.getValue());" />
</Listeners>
</ext:ComboBox>
<ext:Label ID="Month" runat="server" Text="月:" />
<ext:ComboBox ID="getMonth" runat="server" Width="150" FieldLabel="月度" EmptyText="请选择..." Editable="false">
<Listeners>
<Change Handler="highMonth.setValue(getMonth.getValue());" />
</Listeners>
</ext:ComboBox>
后台代码
#region 绑定年度月度下拉
private void DataBindYearMonth()
{
for (int i = 2010; i <= 2020; i++)
{
Coolite.Ext.Web.ListItem listItem = new Coolite.Ext.Web.ListItem(i.ToString(), i.ToString());
cbbYear.Items.Add(listItem);
getYear.Items.Add(listItem);//获取年查询
highYear.Items.Add(listItem);//获取年查询(高级)
}
for (int i = 1; i <= 12; i++)
{
Coolite.Ext.Web.ListItem listItem = new Coolite.Ext.Web.ListItem(i.ToString(), i.ToString());
cbbMonth.Items.Add(listItem);
getMonth.Items.Add(listItem);//获取月查询
highMonth.Items.Add(listItem);//获取月查询(高级)
}
cbbYear.SelectedItem.Value = DateTime.Now.Year.ToString();
cbbMonth.SelectedItem.Value = (DateTime.Now.Month + 1).ToString();
}
#endregion
<ext:ComboBox ID="getYear" runat="server" Width="150" FieldLabel="年度" EmptyText="请选择..." Editable="false">
<Listeners>
<Change Handler="highYear.setValue(getYear.getValue());" />
</Listeners>
</ext:ComboBox>
<ext:Label ID="Month" runat="server" Text="月:" />
<ext:ComboBox ID="getMonth" runat="server" Width="150" FieldLabel="月度" EmptyText="请选择..." Editable="false">
<Listeners>
<Change Handler="highMonth.setValue(getMonth.getValue());" />
</Listeners>
</ext:ComboBox>
后台代码
#region 绑定年度月度下拉
private void DataBindYearMonth()
{
for (int i = 2010; i <= 2020; i++)
{
Coolite.Ext.Web.ListItem listItem = new Coolite.Ext.Web.ListItem(i.ToString(), i.ToString());
cbbYear.Items.Add(listItem);
getYear.Items.Add(listItem);//获取年查询
highYear.Items.Add(listItem);//获取年查询(高级)
}
for (int i = 1; i <= 12; i++)
{
Coolite.Ext.Web.ListItem listItem = new Coolite.Ext.Web.ListItem(i.ToString(), i.ToString());
cbbMonth.Items.Add(listItem);
getMonth.Items.Add(listItem);//获取月查询
highMonth.Items.Add(listItem);//获取月查询(高级)
}
cbbYear.SelectedItem.Value = DateTime.Now.Year.ToString();
cbbMonth.SelectedItem.Value = (DateTime.Now.Month + 1).ToString();
}
#endregion