2012-01-02 69 views
0

我在Windows窗體中有數據中繼器,數據中繼器內有一個標籤和一個單選按鈕或組合框,單選按鈕的數量和文本是從我的數據庫中引入的,就像標籤和組合框一樣。獲取數據中繼器中單選按鈕的狀態

標籤是一個問題,單選按鈕或組合框允許用戶回答問題。

我想要做的是獲取單選按鈕的選中狀態,以便我可以在需要時顯示下一個問題。例如只顯示問題2如果問題1回答號

回答

0
'0 = Index in Repeater. 
Dim bolChecked As Boolean = CType(rptYourRepeater.Items(0).FindControl("IdOfRadioButton"), RadioButton).Checked 
+0

我得到的,說:「‘物品’不是‘Microsoft.VisualBasic.PowerPacks.DataRepeater’成員」 – willj12 2012-01-02 18:56:31

+0

我得到了一些它的工作的錯誤,當你點擊一個按鈕時,如果它被選中,它會顯示一個真或假的消息框。 'Dim bolChecked As Boolean = CType(rptYourRepeater.CurrentItem.Controls(「IdOfRadioButton」),RadioButton).Checked MsgBox(bolChecked)' – willj12 2012-01-02 19:16:29

+0

我很抱歉混淆了DataRepeater和Repeater Controls,並且很高興您能夠正常工作。 – N0Alias 2012-01-02 21:01:46

相關問題