0
我有一個從單獨的下拉列表選定值綁定到第二頁的下拉列表。數應爲 「563000」,而是當列表填充它讀取... 垂直?這是我用來綁定的代碼。垂直傾斜的DropDownList值
Protected Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click
Dim val1 As String = DropDownList1.SelectedValue.Substring(0, 6)
Dim val2 As String = DropDownList1.SelectedValue.Substring(0, 4)
Session("value1") = val1.ToString
Session("value2") = val2.ToString
Response.Redirect("Page2.aspx")
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DropDownList1.DataSource = CType(Session.Item("value1"), String)
DropDownList1.DataBind()
DropDownList2.DataSource = CType(Session.Item("value2"), String)
DropDownList2.DataBind()
End Sub
任何人都有一個想法,爲什麼這可能會發生?
你在'Page_Load'引用'「valCodes」'和'「valAccts」',但你的例子不會顯示那些會話值填充在哪裏。你能提供嗎? – TLS 2012-04-27 19:59:11
我剛剛更改爲值,我認爲使用通用名稱會更容易混淆。 valCodes和valAccts是noe值1和值2 – developthestars 2012-04-27 20:04:11