title: How to pass Event Validation when editing a select list from JavaScript
body: <p>I have two select lists in my ASP.NET site that are filled by the server with some elements.</p>
  
  <pre><code>// .aspx
  &lt;asp:dropdownlist id="abc" runat="server"&gt;&lt;/asp:dropdownlist&gt;
  &lt;asp:dropdownlist id="def" runat="server"&gt;&lt;/asp:dropdownlist&gt;
  
  // .aspx.cs
  abc.Items.Add(new ListItem("element1", "value1"));
  def.Items.Add(new ListItem("element1", "value1"));
  </code></pre>
  
  <p>Due to too complicated reasons to explain right now, I also need to modify the options of the select lists with JavaScript, adding some values.</p>
  
  <pre><code>// In the &lt;head&gt; of the .aspx page
  var abcList = document.getElementById("abc");
  var defList = document.getElementById("def");
  var newAbcElement = new Option("element2", "value2", false, false);
  var newDefElement = new Option("element2", "value2", false, false);
  abcList.options[abcList.length] = newAbcElement;
  defList.options[defList.length] = newDefElement;
  </code></pre>
  
  <p>Of course, this will mess up Even Validation as soon as I send the form back to the server (be it by submitting or as a PostBack from some other form elements with <code>AutoPostBack="true"</code>).</p>
  
  <blockquote>
    <p>Invalid postback or callback argument.  Event validation is enabled using  in configuration or &lt;%@ 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. </p>
  </blockquote>
  
  <p>Now, I don't have the resources and budget to completely overhaul the whole page design, so: What is the <strong>fastest</strong> and <strong>easiest</strong> way to change the dropdownlist that does not mean I have to rewrite the whole thing?</p>
  
  <p>So that the values added via JavaScript are recognized by my CodeBehind file when submitting the form?</p>