KuKeC KuKeC - 9 months ago 44
Vb.net Question

How to bind integer value from database to RadioGroup in GridView?

I have a problem when i try to bind integer value from database to

in each row (as one column). In my database integer columns "status" has 3 states (active, inactive, archive) represented as values (1,2 and 3 in database). So i would like to get something like this

enter image description here

(Designer) i defined all 3 states and after creating that "custom radio button column", i binded to my column from
. But still the values from database are not filling and i can only focus only 1 radio group, after i change row, my selected value from previous row is lost.

Funny thing is that if i have 2 fields in GridView (integer from database, and radioGroup binded for integer value), after i change values from radioGroup from 1 status to another, the value is changing for integer value as well but the value for radioGroup is showing only for focused row. So how to turn on displaying selected value in radioGroup?

I found some solutions that i should use checkedit, not radiogroup, but i don't get it how to show 3 states with checkbox (2 states, checked and unchecked).

Any help/guidance would be nice.

Thanks in advance


The problem was in defining collection RadioGroup.items

I'v putted 3 different states but as type int 16 (first integer data type in selection) and it had to be int 32. After that everything works.