找到FORMVIEW里的所有控件
WebControl txtName = (WebControl)frmRecordView.FindControl("txtPoid");//找到FORMVIEW里的单个控件
ControlCollection ctls = txtName.Parent.Controls;
foreach (System.Web.UI.Control ctr in ctls)
{
if (ctr is System.Web.UI.WebControls.TextBox)
{
TextBox txt = (TextBox)ctr;
txt.ReadOnly = true;
txt.Enabled = false;
}
if (ctr is System.Web.UI.WebControls.DropDownList)
{
DropDownList ddl = (DropDownList)ctr;
ddl.Enabled = false;
}
}
ControlCollection ctls = txtName.Parent.Controls;
foreach (System.Web.UI.Control ctr in ctls)
{
if (ctr is System.Web.UI.WebControls.TextBox)
{
TextBox txt = (TextBox)ctr;
txt.ReadOnly = true;
txt.Enabled = false;
}
if (ctr is System.Web.UI.WebControls.DropDownList)
{
DropDownList ddl = (DropDownList)ctr;
ddl.Enabled = false;
}
}

浙公网安备 33010602011771号