-->

How to store and retrieve the RadioGroup Radio But

2019-06-10 00:49发布

问题:

In my form I used Ribbon control in that RadioGroup is used for calculations. Now I need to store content of form and want to retrieve it back if I click in Gridview. I can able to store and retrieve textedit, lookup edit and checkedit outside Ribbon Control. How to store and retrieve the RadioGroup from Ribbon Control ??

example for storing CheckBox I used this code

 bool temp = barCheckItem1.Checked;

In Access Database used "Yes/No" Data Type to store. For retrieve used this code

 barCheckItem1.Checked = reader.GetBoolean(2);

this code work fine for CheckBox but I need to Store RadioButton RadioGroup. How to Store & Retrieve it ?? Help me. Thanks in Advance.

回答1:

Just store barEditItem.EditValue which is the selected item in the RadioButton.

I assume you have int as EditValue from your previous question. So this should be enough.

int selectedItem = (int)barEditItem.EditValue;//To Store

Store the selected item in DB

barEditItem.EditValue = reader.GetInt32(index);//To retrieve back