W
William LaMartin
On an aspx page, I place ASP.Net controls of a DropDownList, a button and a
label. The DropDownList is populated from an xml file . When the button is
clicked the selected value of the DropDown List is displayed in the label.
All very simple, and it works fine in Internet explorer, but in Firefox
simply changing the selection in the DropDownList produces the error listed
below. I have done a bit of web searching and found reasons for this but
the suggested solutions(or ant least my implementation of them) do not work
for me.
Any Ideas?
My code
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Not (IsPostBack) Then
Dim ds1 As New Data.DataSet
ds1.ReadXml(Server.MapPath(".") & "\App_Data\States.xml")
Me.ddlState.DataTextField = "Name"
Me.ddlState.DataValueField = "Name"
Me.ddlState.DataMember = "State"
Me.ddlState.DataSource = ds1.Tables(0)
Me.ddlState.DataBind()
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles Button1.Click
Me.Label1.Text = Me.ddlState.SelectedValue
End Sub
End Class
The error:
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.
label. The DropDownList is populated from an xml file . When the button is
clicked the selected value of the DropDown List is displayed in the label.
All very simple, and it works fine in Internet explorer, but in Firefox
simply changing the selection in the DropDownList produces the error listed
below. I have done a bit of web searching and found reasons for this but
the suggested solutions(or ant least my implementation of them) do not work
for me.
Any Ideas?
My code
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Not (IsPostBack) Then
Dim ds1 As New Data.DataSet
ds1.ReadXml(Server.MapPath(".") & "\App_Data\States.xml")
Me.ddlState.DataTextField = "Name"
Me.ddlState.DataValueField = "Name"
Me.ddlState.DataMember = "State"
Me.ddlState.DataSource = ds1.Tables(0)
Me.ddlState.DataBind()
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles Button1.Click
Me.Label1.Text = Me.ddlState.SelectedValue
End Sub
End Class
The error:
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.