碰上个怪问题,搞了一天了,请高手指点
照片类别: <asp:DropDownList ID= "ddlProductClass " runat= "server " AutoPostBack= "True " OnSelectedIndexChanged= "ddlClass_SelectedIndexChanged ">
</asp:DropDownList>
<asp:DropDownList ID= "ddlProductSmallClass " runat= "server ">
</asp:DropDownList>
//前台两个下拉菜单,选择大类和小类的。
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindClass();
BindSmallClass();
if (this.ddlProductSmallClass.Items.Count == 0)
{
ListItem lt = new ListItem( "暂无分类 ", "0 ");
ddlProductSmallClass.Items.Add(lt);
}
}
}
protected void BindClass()
{
DataTable dt = new DataTable();
myDAL.GetClassName(dt);
ddlProductClass.Items.Clear();
ddlProductClass.DataSource = dt;
ddlProductClass.DataTextField = "P_ClassName ";
ddlProductClass.DataValueField = "ID ";
ddlProductClass.DataBind();
}
protected void BindSmallClass()
{
DataTable dt = new DataTable();
myDAL.GetSmallClassByClassID(Convert.ToInt32(ddlProductClass.SelectedValue), dt);
ddlProduc