How do I highlight a textbox border red when it is required?

后端 未结 5 1864
谎友^
谎友^ 2020-12-05 05:52

What property do I use on the required field validator control to make the textbox red if there is a validation error?

Here is my code:



        
5条回答
  •  星月不相逢
    2020-12-05 06:32

    ASP.Net web forms internally uses a Javascript frameworka located at aspnet_client\{0}\{1} folder to handle the validation, etc. They are basically determined from the property ClientScriptsLocation

    Try overriding the default framework function by keeping it in your page includes additional line to set the control_to_validate color

    document.getElmentById(val.controltovalidate).style.border='1px solid red';

    
    
    
    

    JS

    
    

提交回复
热议问题