我正在尝试通过下拉列表显示会话值。这是我制作的代码,但效果不佳。纠正我
//session created
public void SAN()
{
cn.Open();
string sq = "select Sitealiasname from tbl_Sitemaster where sitename in (select sitename from tbl_emploeedetails where employeestatus='L' and employeeid='" + Session["EMPID"].ToString() + "') and status='A' order by Sitealiasname asc";
SqlCommand d = new SqlCommand(sq, cn);
SqlDataReader r;
r = d.ExecuteReader();
while (r.Read())
{
Label4.Text = r["Sitealiasname"].ToString().Trim();
Session["Sitealiasname"] = Label4.Text;
}
cn.Close();
}
//call the session to dropdownlist
protected void Page_Load(object sender, EventArgs e)
{
ddlsite.Text = Session["Sitealiasname"].ToString();
}