protected void btnbatch_Click(object sender, EventArgs e)
{
Button btnactual= sender as Button;
ContentPlaceHolder myContent =
(ContentPlaceHolder)this.Master.FindControl("ContentPlaceHolder1");
}
如何使用for-each
在内容占位符中查找控件。我将代码放在Div tag
中
但我没有得到。
任何人都可以帮帮我吗?
答案 0 :(得分:6)
Protected void btnbatch_Click(object sender, EventArgs e)
{
Button btnactual= sender as Button;
ContentPlaceHolder myContent =
(ContentPlaceHolder)this.Master.FindControl("ContentPlaceHolder1");
foreach (Control ctrl in myContent.FindControl("divBatches").Controls)
{
if (ctrl.ID == btnactual.ID)
{
//blah blah
}
}
}
试试这个......