c# - Check radio button in RadioButtonList based on value read from database -
i have radiobuttonlist , select radio button in list based on value read database. once read value database, how make radio button in list become selected?
you can assign value via radiobuttonlist.selectedvalue = reader.value;
long know value in list (if it's not in list, exception when line executes).
since sounds not know sure reader.value
1 of options in radiobuttonlist
, need check first.
if(radiobuttonlist.items.findbyvalue(reader.value) != null) { radiobuttonlist.selectedvalue = reader.value; }
alternatively, handle exception via try/catch.
Comments
Post a Comment