[.NET] 請問多個RadioButtonList的值,要如何存入一個陣列之中
網站專案:
請問如果我在網頁上放置多個RadioButtonList,
然後我打算將之個別的Value放入同一個陣列當中,
就像這樣↓
protected void Button1_Click(object sender, EventArgs e)
{
string[] str=new string[5];
if (RadioButtonList1.SelectedIndex > -1)
{
str[0] = RadioButtonList1.SelectedItem.Value;
}
if (RadioButtonList2.SelectedIndex > -1)
{
str[1] = RadioButtonList2.SelectedItem.Value;
}
}
請問有辦法用迴圈把RadioButtonList1跟RadioButtonList的Value放入陣列嗎?
還是只能像我這樣用手工來做呢,
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.134.245.169