找到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;
                            }
                        }
posted @ 2009-05-13 16:48  富硒荔枝  阅读(160)  评论(0)    收藏  举报