怎么实现 传过来的值 radiobuttonlist直接被选中

2024-11-27 05:33:48
推荐回答(5个)
回答1:

string id = Request.QueryString["id"];
if (!string.IsNullOrEmpty(id))
{
for (int i = 0; i < LanId.Items.Count; i++)
{
if (LanId.Items[i].value == id)
{
LanId.Items[i].Selected = true;
break;
}
}
}

回答2:

for (int i = 0; i < radiobuttonlist.Items.Count; i++)
{
if (radiobuttonlist.Items[i].value== "3")
{
radiobuttonlist.Items[i].Selected = true;
}
}

回答3:

RadioButtonList1.Items[i].Selected = true;
i即是你传过来的参数。

回答4:

if (Request["id"丛模闷码指] != null)
{
LanId.Items.FindByValue(Request["渗弯id"]).Selected = true;
}

回答5:

if(!IsPostBack)
{
radiobuttonlist.Items.selectecindex=3+1;
}