aspx页面如何调用 用户控件中2个dropdownlist联动的值。
代码如下:ODB link = new ODB();public string list1//属性
{
get { return ddlOne.SelectedValue;}
set {ddlOne.SelectedValue=value;}
}
public string list2//属性
{
get { return ddlTwo.SelectedValue; }
set { ddlTwo.SelectedValue = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
link.DDlist("bclassid", "bName", "OneClass", ddlOne);
ListItem Skins4 = new ListItem("--请选择一级分类--"); //增加一个空白项,并使之位于首位。
ddlOne.Items.Insert(0, Skins4);
link.DDlist("sclassid", "sclass", "Twoclass", ddlTwo);
ListItem Skins5 = new ListItem("--请选择二级分类--"); //增加一个空白项,并使之位于首位。
ddlTwo.Items.Insert(0, Skins5);
}
}
protected void ddlOne_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
string select = ddlOne.SelectedItem.Text;
string sql = "select sclassid,sclass from Twoclass where bclassid in(select bclassid from OneClass where bName='" + select + "') ";
DataTable dt = link.GetDt(sql);
ddlTwo.DataSource = dt;
ddlTwo.DataValueField = "sclassid";
ddlTwo.DataTextField = "sclass";
ddlTwo.DataBind();
}
catch (Exception er)
{
throw new Exception(er.Message);
}
}
}
我想在aspx页面调用 用户控件中2个dropdownlist联动的属性值。怎么写代码呀?????