我仍在努力了解并找到解决以下问题的方法:
我有一个自定义验证器:
<asp:Button ID="ButtonSave" UseSubmitBehavior="false"
ValidationGroup="test" Enabled="false" runat="server"
Text="Valider modifications" OnClick="ButtonSave_Click"
CssClass="btn ButtonSave" Width="200px"
style="margin-right:5px; margin-bottom:10px; margin-top:10px" />
我有一个调用此自定义验证器的按钮:
CheckBox
我还有<td class="transparent">
<asp:CheckBox ID="Type_CheckBoxCancel"
Text="Cancel" runat="server" CssClass="EntreeCheckbox"
TextAlign="Right" OnCheckedChanged="Type_CheckBoxCancel_CheckedChanged"
AutoPostBack="true" />
</td>
一个事件:
ButtonSave
如果我直接点击CheckBox
,我的自定义验证器会被正确调用,我可以进行所有检查。但是,当我点击我的import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
class LotoTicket {
private static final int NUM_NUMBERS = 6;
private static final int NUM_BALLS = 99;
private static final Random random = new Random();
private final int[] numbers;
private LotoTicket(final int[] numbers) {
this.numbers = numbers;
}
public static LotoTicket generateTicket() {
final int[] numbers = new int[NUM_NUMBERS];
final List<Integer> ballPool = IntStream.range(1, 1 + NUM_BALLS)
.mapToObj(i -> i)
.collect(Collectors.toList());
for (int i = 0; i < NUM_NUMBERS; i++) {
final int draw = random.nextInt(NUM_BALLS - i);
numbers[i] = ballPool.remove(draw);
}
Arrays.sort(numbers);
return new LotoTicket(numbers);
}
public int[] getNumbers() {
return numbers;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("LotoTicket{");
sb.append("numbers=").append(Arrays.toString(numbers));
sb.append('}');
return sb.toString();
}
public static void main(final String... args) {
System.out.println(LotoTicket.generateTicket());
System.out.println(LotoTicket.generateTicket());
System.out.println(LotoTicket.generateTicket());
}
}
然后点击我的按钮时,我的自定义验证器不再被调用。我真的不明白这种行为
如果有人可以向我提出解决方案,请吗?