Stop postback on TextChanged

后端 未结 5 1621
鱼传尺愫
鱼传尺愫 2021-01-13 17:26

I have a textbox in an aspx page that has a TextChanged event attached to it. I also have a validator attached to the textbox.

When the text is changed, the validate

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-13 17:56

    What I do is in my client validation function I test the event type I am in. If the event shows me in a change event, I claim the validation passed and leave.

    		if (event.type === 'change') {
    			args.IsValid.true;
          return;
    		}

    I believe this is the best solution as you can leave the validator wired up and the textbox set as you like and no longer worry about the change event causing the validation.

提交回复
热议问题