asp.net 的 textbox控件怎么设置readonly属性?
如果直接在页面中设置该属性的话,会导致后台代码无法获取到textbox中的值
以下方法简单实用:
   protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            txt_start.Attributes["readonly"] = "true";
            txt_end.Attributes["readonly"] = "true";
        }
    }
即在后台代码的page_load里面设置textbox控件的readonly属性。
                  
                  
                  
                  
                            
本文介绍了一种在ASP.NET中为TextBox控件设置readonly属性的方法,这种方法不会影响后台代码获取TextBox中的值。通过在Page_Load事件中使用Attributes集合来实现。
          
      
          
                
                
                
                
              
                
                
                
                
                
              
                
                
              
            
                  
					698
					
被折叠的  条评论
		 为什么被折叠?
		 
		 
		
    
  
    
  
            


            