为了解释我的情况......我正在从一个 mysql 表中填充一个列表框,比如这个
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim cmdtext = "SELECT * FROM avail_workouts"
Using conn = New MySqlConnection(connString)
Using cmd = New MySqlCommand(cmdtext, conn)
conn.Open()
reader = cmd.ExecuteReader()
While reader.Read()
ListBox1.Items.Add(reader("workout"))
End While
End Using
End Using
End Sub
然后,我选择列表框中的一项并单击一个按钮(该按钮将对从列表框中选择的值执行某些操作),该按钮现在什么都不做。那是我收到此错误的时候
Invalid postback or callback argument.
Event validation is enabled using <pages enableEventValidation="true"/>
in configuration or <%@ Page EnableEventValidation="true" %> in a page.
For security purposes, this feature verifies that
arguments to postback or callback events originate
from the server control that originally rendered them.
If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation
method in order to register the postback or callback data for validation.
我尝试使用
EnableEventValidation="false"
这似乎有效,直到我尝试使用列表框中的选定值。当我单击按钮时,它似乎忘记了选择的值。那么,我怎样才能简单地填写一个列表框,在列表框中选择一行,然后单击将使用所选值的按钮而不会出现此错误?
提前致谢!