R
rn5a
I have 2 ListBoxes which get populated with records from a database.
The Form has a Button as well. Note that users can select multiple
items in both the ListBoxes.
When a user selects items from the 1st ListBox & clicks the Button,
the selected items get deleted from the 1st ListBox & get appended to
the 2nd ListBox at the very end. I also want that the items that have
just got appended to the 2nd ListBox should also get selected. In
other words, to view the just appended items in the 2nd ListBox, I
don't want users to scroll down the 2nd ListBox to view the newly
appended items. Instead, the 2nd ListBox should automatically scroll
down after the items get appended to the 2nd ListBox.
I am trying to do this using JavaScript (using the OnClientClick event
of the Button server control) but ASP.NET generates the following
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.
I tried to overcome this error by adding the following code:
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
MyBase.Render(writer)
ClientScript.RegisterForEventValidation(lstBox1.ID)
End Sub
but that doesn't make any difference. The error still persists.
If I set EnableEventValidation to False in the Page directive, then
the error doesn't get generated but at the same time, the items
selected in the 1st ListBox do not get appended to the 2nd ListBox.
Can someone please give me some idea on how do I overcome this error?
The Form has a Button as well. Note that users can select multiple
items in both the ListBoxes.
When a user selects items from the 1st ListBox & clicks the Button,
the selected items get deleted from the 1st ListBox & get appended to
the 2nd ListBox at the very end. I also want that the items that have
just got appended to the 2nd ListBox should also get selected. In
other words, to view the just appended items in the 2nd ListBox, I
don't want users to scroll down the 2nd ListBox to view the newly
appended items. Instead, the 2nd ListBox should automatically scroll
down after the items get appended to the 2nd ListBox.
I am trying to do this using JavaScript (using the OnClientClick event
of the Button server control) but ASP.NET generates the following
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.
I tried to overcome this error by adding the following code:
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
MyBase.Render(writer)
ClientScript.RegisterForEventValidation(lstBox1.ID)
End Sub
but that doesn't make any difference. The error still persists.
If I set EnableEventValidation to False in the Page directive, then
the error doesn't get generated but at the same time, the items
selected in the 1st ListBox do not get appended to the 2nd ListBox.
Can someone please give me some idea on how do I overcome this error?