在WebForm1.aspx中有个DropDownList,现在想在Class1.cs中来调用DropDownList值,如何做.
例如:string StrConn=System.Configuration.ConfigurationSettings.AppSettings["xxx"].ToString().Trim()中的xxx值是DropDownList所选择的值.大家注意了,在Class1.cs中好象没有Session对象的哦.很多人都想用Session.大家可以试试.
例如:string StrConn=System.Configuration.ConfigurationSettings.AppSettings["xxx"].ToString().Trim()中的xxx值是DropDownList所选择的值.大家注意了,在Class1.cs中好象没有Session对象的哦.很多人都想用Session.大家可以试试.
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
DropDownList sd=(DropDownList)sender;
string str=sd.SelectedValue.ToString();
string StrConn=System.Configuration.ConfigurationSettings.AppSettings[str].ToString().Trim();
//其他代码
}