how do I set disabled attribute on html textbox in asp.net-mvc?

前端 未结 3 656
走了就别回头了
走了就别回头了 2021-01-05 05:12

I am trying to dynamically set the disabled attribute on the html textbox and having issues

I tried this in my view:

 string disabledString = \"\";
          


        
3条回答
  •  Happy的楠姐
    2021-01-05 05:39

    I think you want to omit the disabled attribute altogether when you want it to be enabled. Older browsers would look at the following and disable the text boxes:

    
    

    In other words in older HTML the ="disabled" was not necessary so for compatibility reasons you should just omit the attribute if you want it to render right. I'm not sure what happens if you try a strict DOCTYPE, though.

提交回复
热议问题