Hi there,
this is the situation:
I have a table that contains a bit field called "IsAllowed". It is either set to "False" or "True" or "NULL". Next, I have a gridview control that is bound to this table (actually it is more complicated, but for the sake of simplicity, this works as well ;-)).
One column of this gridview originally contained a checkbox saying "Is allowed" and which was checked or not depending on the bit fields state. Now I need to have a radiobuttonlist instead that should contain the options "Is allowed" (which value is set to "True") and "Is not allowed" (which value is set to "False"). What I need to do now is bind these choices to the bit field so that if I add a new row, the radiobuttonlist is preset with what data is read from the table.
Example:
Table says: IsAllowed = True -> RadioButtonList says: Is allowed x Is not allowed o
Table says: IsAllowed = False -> RadioButtonList says: Is allowed o Is not allowed x
Table says: IsAllowed = NULL -> RadioButtonList says: Is allowed o Is not allowed o
Although this does not seem to be very hard, I have a problem. I added new items to the radiobuttonlist saying "Is allowed" (Value = True) and "Is not allowed" (Value = False). Then I created a query in my DAL that retrieves the value from the table. The result is either a True, a False or a NULL. Then I bound the resulting DataTable to the RadioButtonList control (everything through a ObjectDataSource control).
And the result?
Actually, the radiobuttonlist doesn't show the options I manually entered into the list, but only "o False" if the table says False, "o True" if the table says True and "o" if the table says NULL. Does anyone have a hint for me? I hope, I described the problem in an understandable way...
Thank you very much and best regards,
Christian.