2011-04-04 130 views
0

我在C#代碼中定義數據源,我有一個提交按鈕這需要在RadioButtonListRadioButtonList.Selectedvalue返回一個空字符串

asp:RadioButtonList ID="RadioPaidIdList" runat="server" DataValueField ="Label" DataTextField = "Label" 

首播時間值我點擊提交,返回一個空值。下次我選擇一個radiolist並點擊提交它返回一個合適的值。 奇怪!

+1

我猜你在談論的WebForms。您何時將這些值添加到單選按鈕列表? OnInit,OnLoad或OnPreRender。確保在事件觸發之前添加它們,並且OnInit或OnLoad(如果這樣做)OnPreRender太遲了。 – 2011-04-04 03:42:42

回答

1

確保在表單中選擇了默認單選按鈕。在WPF和winforms中的代碼checked =「true」。

0
RadioButtonList1.SelectedItem.Text; 


RadioButtonList1.SelectedValue; 

適用絲束的任何一個...... 我希望它幫你........