如何从cs文件C#中启用禁用的下拉菜单、文本框
public void fill_name_selectedindexchanged(object sender, EventArgs ex)
{
//txt_name.Enabled = true;
ddl_title.Attributes.Add("enabled", "enabled");
txt_full_name.Attributes.Add("enabled", "enabled");
txt_login_name.Attributes.Add("enabled", "enabled");
txt_email.Attributes.Add("enabled", "enabled");
txtDefaultCompany.Attributes.Add("enabled", "enabled");
//txt_name.Text = "";
ddl_title.Items.Clear();
txt_full_name.Text = "";
txt_login_name.Text = "";
txt_password.Text = "";
txt_email.Text = "";
AutoCompleteExtender1.ContextKey = ddl_user_type.SelectedValue.Trim();
string val = ddl_user_type.SelectedValue;
if (val.Trim() == "N")
{
ddl_title.Attributes.Add("enabled", "enabled");
txt_full_name.Attributes.Add("enabled", "enabled");
txt_login_name.Attributes.Add("enabled", "enabled");
txt_email.Attributes.Add("enabled", "enabled");
txtDefaultCompany.Attributes.Add("enabled", "enabled");
txt_full_name.Text = "";
txt_login_name.Text = "";
txt_email.Text = "";
mm.getlookup(ddl_title, "title", "u");
}
}
下拉菜单和文本框保持禁用状态,不会更改为启用。