How to place a required field validator inside a GridView TextBox

前端 未结 2 1940
长情又很酷
长情又很酷 2021-01-29 00:32

I have a GridView with some TemplateField items containing TextBox controls. I would like to add a required field validator on it. This is

2条回答
  •  孤街浪徒
    2021-01-29 01:00

    In the Edit template, add a RequiredFieldValidator like this:

    
        
        
        
    
    

    Here is the reference for the RequiredFieldValidator on MSDN.

    UPDATE:

    If you wanted a regular expression validator, its pretty much the same, but with the RegularExpressionValidator control:

     
    

    Here is a complete list of the functionality for the RegularExpressionValidator on MSDN.

提交回复
热议问题