开发者

ASP.NET Ajax and Validator problem

开发者 https://www.devze.com 2023-01-24 07:30 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消