Changing the value of a DropDownList in .Net client side

amrhusen

New Member
Assuming that I can't modify the code-behind file for a site (it's a compiled site), I've encountered a bug of mine that can only be fully fixed with a complete recompile and redeployment. Unfortunately, we are on a strict release schedule and we can't deploy for another 11 days.The bug is that I'm doing a check on a drop down to make sure that the value that is selected isn't "-1". However, I didn't use drp.SelectedItem.Value, I used drp.Items[0].Value. Total bonehead move on my part. The bottom line is that drp.Items[0].Value is ALWAYS -1, so they page gives an error to the user stating that they need to choose an option for that drop down. Which they really have, but my bug is not letting them continue in this process.Because I'm an idiot.So, I'm trying to determine if I could, client-side, replace the value of the first drp item to the actually chosen value of that drop down.I've gotten this all to work client-side, but when the form is posted back, the value is still the value that was populated from code, meaning "-1".I'm sure this is because the drop down is loaded and all the values are held in ViewState.Can anyone think of a .Net friendly solution to this? I'm really hoping there is one.
 
Back
Top