62,025
社区成员
发帖
与我相关
我的任务
分享
protected void Button1_Click(object sender, EventArgs e)
{
string selectValue = string.Empty;
foreach (GridViewRow item in this.gvList.Rows)
{
RadioButtonList rList = (RadioButtonList)item.FindControl("RadList1");
if (rList.SelectedValue != string.Empty)
{
selectValue += rList.SelectedValue + ";";
}
}
//输出每个RadioButtonList选择的值
Response.Write(selectValue);
}
protected void BtnSumit_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in Gridview1.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
RadioButtonList rbs = ((RadioButtonList)row.FindControl("RadList1"));
for (int i = 0; i < rbs.Items.Count; i++)
{
if (rbs.Items[i].Selected == true)
{
Response.Write(rbs.Items[i].Text)//or Value
}
}
}
}
}