我有三个下拉菜单,值部分在 web.config.for Drp_List3 dropdowm 菜单中我有值和文本,但我想在下拉菜单中显示文本值,但要连接我想要值。抱歉,如果我听起来很愚蠢的话。
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string server = ConfigurationManager.AppSettings["SV"].ToString();
string[] val1 = server.Split(',');
foreach (string str1 in val1)
{
Drp_List1.Items.Add(str1);
}
string website = ConfigurationManager.AppSettings["site"].ToString();
string[] val2 = website.Split(',');
foreach (string str2 in val2)
{
Drp_List2.Items.Add(str2);
}
string sitetype = ConfigurationManager.AppSettings["ErrorLog"].ToString();
string[] val3 = sitetype.Split(',');
foreach (string str3 in val3)
{
Drp_List3.Items.Add(new ListItem(str3));
}
string sitetypedetail = ConfigurationManager.AppSettings["ErrorLogType"].ToString();
string[] val4 = sitetypedetail.Split(',');
foreach (string str4 in val4)
{
Drp_List3.Items.Add(new ListItem(str4));
}
}
}