[英]How to use Radio Button in Repeater to retrieve data from sql?
如您所知,您的 RadioButtns 在中繼器中,因此您必須使用Foreach
循環將這些按鈕文本從中繼器設置為:
foreach (RepeaterItem item in Repeater1.Items)
{
// Check for data item or alternating item
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
// find your radiobutton from repeater's item
RadioButton RadioButton1 = item.FindControl("RadioButton1") as RadioButton;
RadioButton1.Text = dr.GetString(5);
//.. some other code
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.