控制界面是否可输入的一个例子

         private   void  EnableForm( bool  isReadOnly)
        
{
            
bool isEndble = !isReadOnly;
            Control ctl 
= txtProposer.Parent;
            
foreach(Control sonctl in ctl.Controls)
            
{
                
if (sonctl is TextBox)
                
{
                    ((TextBox)sonctl).Attributes[
"readOnly"= isReadOnly.ToString();
                }


                
if (sonctl is HtmlInputText)
                
{
                    ((HtmlInputText)sonctl).Attributes[
"readOnly"= isReadOnly.ToString();
                }


                
if (sonctl is RadioButtonList)
                
{
                    ((RadioButtonList)sonctl).Enabled 
= isEndble;
                }


                
if (sonctl is DropDownList)
                
{
                    ((DropDownList)sonctl).Enabled 
= isEndble;
                }

            }

        }

你可能感兴趣的:(控制界面是否可输入的一个例子)