ASP.NET怎么得到母版页中DataList中的Label控件的值?急求,高人帮忙 10
1个回答
展开全部
//循环gridview里的checkbox,看是那个被选择,则发送时根据所选的发送过去
foreach (GridViewRow gvr in GridView1.Rows)
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
if (((CheckBox)gvr.FindControl("checkbox")).Checked)
{
//单选或全选
sendMs();
ok = false;
break;
}
}
}
}
//单选或全选传递值
private void sendMs()
{
string name = null;
string pass = null;
string mobile = null;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
if (((CheckBox)GridView1.Rows[i].FindControl("checkbox")).Checked)
{
name += GridView1.Rows[i].Cells[1].Text.ToString();
pass += GridView1.Rows[i].Cells[2].Text.ToString();
mobile+= GridView1.Rows[i].Cells[3].Text.ToString();
}
}
我这个是在gridview里获取复选框
LZ看看对你是否有帮助
foreach (GridViewRow gvr in GridView1.Rows)
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
if (((CheckBox)gvr.FindControl("checkbox")).Checked)
{
//单选或全选
sendMs();
ok = false;
break;
}
}
}
}
//单选或全选传递值
private void sendMs()
{
string name = null;
string pass = null;
string mobile = null;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
if (((CheckBox)GridView1.Rows[i].FindControl("checkbox")).Checked)
{
name += GridView1.Rows[i].Cells[1].Text.ToString();
pass += GridView1.Rows[i].Cells[2].Text.ToString();
mobile+= GridView1.Rows[i].Cells[3].Text.ToString();
}
}
我这个是在gridview里获取复选框
LZ看看对你是否有帮助
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询