<td colspan="" id="td_ddl" runat="server">
</td>
后台代码:

            #region 动态拼出未知个数的下拉框列表,每个分别绑定成组的三级指标
if (dt != null && dt.Rows.Count > )
{
string tempIndi = "";
int count = ;
//循环拼出由各条指标的评价标准组成的下拉框html,默认认为同一条二级指标下的三级指标绑定为一个下拉框,否则为不同的二级指标创建下一个下拉框
for (int i = ; i < dt.Rows.Count; i++)
{
if (tempIndi != dt.Rows[i]["ST_LEVEL2_PLAN_TITLE"].ToString().Trim())
{
if (tempIndi.Length == )
{
td_ddl.InnerHtml = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\" width:100%;\"><tr><td>";
}
else
{
td_ddl.InnerHtml = "</asp:DropDownList>";
}
td_ddl.InnerHtml += "<asp:DropDownList runat=\"server\" ID=\"ddl" + count + dt.Rows[i]["IN_LEVEL3_PLAN_ID"].ToString().Trim() + "\" AutoPostBack=\"true\" >";
td_ddl.InnerHtml += "<asp:ListItem Value=\"" + dt.Rows[i]["IN_LEVEL3_PLAN_ID"].ToString().Trim() + "\">" + dt.Rows[i]["ST_LEVEL3_PLAN_TITLE"].ToString().Trim() + "</asp:ListItem>";
tempIndi = dt.Rows[i]["ST_LEVEL2_PLAN_TITLE"].ToString().Trim();
count++;
}
else
{
td_ddl.InnerHtml += "<asp:ListItem Value=\"" + dt.Rows[i]["DE_LEVEL3_PLAN_SCORE"].ToString().Trim() + "\">" + dt.Rows[i]["ST_LEVEL3_PLAN_TITLE"].ToString().Trim() + "</asp:ListItem>";
}
}
td_ddl.InnerHtml = "</asp:DropDownList>";
hidDdlCount.Value = count.ToString();
#endregion //循环查找出之前动态生成的dropdownlist
for (int j = ; j < int.Parse(hidDdlCount.Value); j++)
{
DropDownList ddl1 = (DropDownList)(td_ddl.FindControl("ddl" + j + dt2.Rows[]["ST_DAILY_ID"].ToString()));
if (ddl1 != null)
{
ddl1.SelectedIndex = ddl1.Items.IndexOf(ddl1.Items.FindByValue(dt2.Rows[]["ST_DAILY_ID"].ToString()));
break;
} DropDownList ddl2 = (DropDownList)(td_ddl.FindControl("ddl" + j + dt2.Rows[]["ST_WORDNUM_ID"].ToString()));
if (ddl2 != null)
{
ddl2.SelectedIndex = ddl2.Items.IndexOf(ddl2.Items.FindByValue(dt2.Rows[]["ST_WORDNUM_ID"].ToString()));
break;
}
} }
05-08 15:35