我无法为应该跨多个页面工作的 DropDownList 保存会话。这是我现在拥有的代码:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ddlOffice.SelectedValue = Session("Office")
End Sub
这是我分配值的代码......
Protected Sub ddlOffice_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ddlOffice.SelectedIndexChanged
Session("Office") = ddlOffice.SelectedItem.Value.ToString
End Sub
我检查了最后一个值的断点,它肯定正确传递了 - 为加载参数传递的值是“2”,这是正确的,但 SelectedIndexChanged 会话值似乎默认回到 1。总是。任何指针?