using System.Web.UI;
using System.Collections.Generic;
using System;
using acDevWBUI.net.UIWeb;
using acDevWBUIControls.net.UIWeb;
namespace UIDropDownListItemsList_Example11
{
public partial class DefaultExample11Page : Page
{
private List<string> m_nChryslerModels = new List<string> { "Pacifica", "PT Cruiser", "Ypsilon" };
private List<string> m_nJeepModels = new List<string> { "Commander", "Grand Cherokee", "Wrangler" };
private List<string> m_nRenaultModels = new List<string> { "Megane", "Scenic" };
private List<string> m_nVolvoModels = new List<string> { "Volvo V40", "Volvo S60", "Volvo V90" };
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
Default_Example11_idtCarBrands.SelectedIndexChanged += Default_Example11_idtCarBrands_SelectedIndexChanged;
Default_Example11_btnSelectThisCar.Click += Default_Example11_btnSelectThisCar_Click;
}
protected override void OnLoadComplete(EventArgs e)
{
base.OnLoadComplete(e);
if(IsPostBack)
Default_Example11_btnSelectThisCar.Enabled = (Default_Example11_idtCarModels.SelectedIndex != -1);
}
private void Default_Example11_idtCarBrands_SelectedIndexChanged(Object sender, UISelectedIndexChangedEventArgs e)
{
Default_Example11_idtCarModels.DataSource = null;
Default_Example11_idtCarModels.SelectedIndex = -1;
switch (((UIItemsBaseListRow)e.Item).Value)
{
case "Chrysler":
Default_Example11_idtCarModels.DataSource = m_nChryslerModels;
break;
case "Jeep":
Default_Example11_idtCarModels.DataSource = m_nJeepModels;
break;
case "Renault":
Default_Example11_idtCarModels.DataSource = m_nRenaultModels;
break;
case "Volvo":
Default_Example11_idtCarModels.DataSource = m_nVolvoModels;
break;
}
Default_Example11_idtCarModels.DataBind();
}
private void Default_Example11_btnSelectThisCar_Click(Object sender, EventArgs e)
{
Default_Example11_lblSelectedCarBrand.Text = Default_Example11_idtCarBrands.SelectedText;
Default_Example11_lblSelectedCarModel.Text = Default_Example11_idtCarModels.SelectedText;
}
}
}