//通过循环得到网页上的label
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
//通过循环得到网页上的label
foreach (Control c in Page.Controls)
{
foreach (Control childc in c.Controls)
{
if (childc is Label)
{
if (((Label)childc).ID.Length > 4)
{
//判断,截取Label控件信息进行判断
if (((Label)childc).ID.Substring(3, 3) == ds.Tables[0].Rows[i]["r_gwdm"].ToString())
{
((Label)childc).Text = ds.Tables[0].Rows[i]["sl"].ToString();//赋值
}
}
}
}
}
}
}