//前台
<asp:DropDownList ID="ddlmodel" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlmodel_SelectedIndexChanged">
<asp:ListItem Value="2">两</asp:ListItem>
<asp:ListItem Value="3" Selected="True">三</asp:ListItem>
</asp:DropDownList>
//后台
SqlSen ss = new SqlSen();//调用APP_CODE中函数
string text1, text2, text3, size1, size2, size3, width1, width2, width3;
ss.SELIDData(id, out text1, out text2, out text3, out size1, out size2, out size3, out width1, out width2, out width3);
this.t1.Text = text1;
this.t2.Text = text2;
this.t3.Text = text3;
if (this.t3.Text.Equals(""))
{
ddlmodel.SelectedValue = "2";
this.t3.Enabled = false;
}
if (this.t3.Text != "")
{
ddlmodel.SelectedValue = "3";
this.t3.Enabled = true;
}
ddlSize1.SelectedValue = ddlSize1.Items.FindByValue(size1).ToString();//将数据库中的数据调给dropdownlist中,使其有自动选择效果
ddlSize2.SelectedValue = ddlSize2.Items.FindByValue(size2).ToString();
ddlSize3.SelectedValue = ddlSize3.Items.FindByValue(size3).ToString();