I am adding list items in a dropdownlist using javascript and when I click on submit button I get this 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.
Following is my code
<asp:DropDownList ID="dropdownlist" runat="server"></asp:DropDownList>
<script>
var arr = "john,bob,david".split(',');
for (var i = 0; i < arr.length; i++) {
$('#dropdownlist').append('<option value="'+arr[i]+'">'+arr[i]+'</option>');
}
</script>
I know this question has already been asked but none of the solution worked for me.