I have a webform with a TextBox, SaveButton, RequiredFieldValidator, DataGrid and a paging button. They'r开发者_开发知识库e all in a single UpdatePanel. SaveButton saves TextBox value to the database and refreshes the DataGrid. Paging button retrieves next n records and refreshes the DataGrid. The problem is, when I click paging button to refresh the DataGrid, RequiredFieldValidator fires. How can I make it fire only when I click SaveButton?
I have set EnableClientScript="true" and ControlToValidate="textBox1" for the validator.
Restrict the textbox validator and the save button to a Validation Group.
Solved it by setting CausesValidation=false of the paging button.
精彩评论