title: DropDownList - adding missing items on the fly to avoid ArgumentOutOfRangeException
body: <p>I have a dropdownlist with a list of options which is subject to change (e.g. 'active users'). Another data source may include historical data, but I wish to use the 'active users' dropdownlist against it.  This means an ArgumentOutOfRangeException will be thrown so I want to catch that, and insert the required entry into the dropdownlist on the fly.</p>
  
  <p>I've seen a few suggestions that point towards overriding the ondatabinding event within the dropdownlist, I've managed to do this insofar as I can create a static listitem for example "Value does not exist" and bypass the exception.</p>
  
  <p>However I wish rather than "Value does not exist" so show the actual value which we were attempting to find in the ddl.</p>
  
  <p>ondatabinding is passed a standard EventArgs item which doesn't offer much to go on, I can see there is a DataListItemEventArgs class - is this in any way associated with a dropdownlist? I tried directcast on the EventArgs but that didn't work... </p>
  
  <p>So is there any way - within ondatabinding - of finding out the value we're attempting to set on the dll, which causes the ArgumentOutOfRangeException? </p>
  
  <p>Cheers!</p>
  
  <p>ps it's similar to this issue I think: <a href="https://stackoverflow.com/questions/3671556/dynamically-add-item-to-dropdownlist">https://stackoverflow.com/questions/3671556/dynamically-add-item-to-dropdownlist</a></p>