I am getting this error and trying to find a solution for it:
"Invalid postback or callback argument. Event validation is enabled using 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 have been struggling with that error for couple of hours, I looked for solution and find a lot of information about it like that one- but I still don't know how to solve that ( i don't want to Disable eventvalidation )
I am guessing that the error is because I am adding / removing items from drop-down list causing the drop-down values being different from what it loaded with initialy. (so it preventing from clients(like developer tools in chrome) to edit this value)
What can I do in order to solve that? will an ajax call to server after any adding or removing items will do?
This is the code that causing the error
$(".hdn-FU").change(function(el){
var labelText = $('.fuCatControl .file-upload-lbl').text();
var ddl = $('.fuCatControl .thumbnailCombo');
var hidChosenValue = $('#fuCatControl_oldValue');
if (labelText != "No file chosen" && labelText != "" && labelText != null) {
//we need to append the new file name to ddl and delete old one if exist
if (hidChosenValue.val() != "") {
ddl.find("option[value='" + hidChosenValue.val() + "']").remove();
}
hidChosenValue.val(labelText);
ddl.append("<option selected='selected' value='" + labelText + "'>" + labelText + "</option>");
}
});