This one seems strange. There's not a problem when the Next button is clicked, just when the SideBar is clicked.
I've got three textboxes containing dates that I need to validate against each other before allowing the user to proceed to the next page. I use a custom validator without the ControlToValidate property set (this will cause the validator to fire whenever a validating event occurs).
<asp:CustomValidator ID="cvRunstartDateTimes" runat="server" OnServerValidate="cvDateTimes_ServerValidate"></asp:CustomValidator>
The event just calls a validating routine that returns a boolean:
protected void cvDateTimes_ServerValidate(object source, ServerValidateEventArgs args)
{
try
{
args.IsValid = RunStart_fnc_ValidatetDatesAndSetTimes();
}
catch (Exception ecvDateTimes_ServerValidate)
{
string strecvDateTimes_ServerValidate = "cvDateTimes_ServerValidate: " + ecvDateTimes_ServerValidate.Message;
}
}
You set the IsValid property to true or false with the returned boolean, and you should be good to go.
It works correctly when the Next button is pressed. The boolean is returned, the args.IsValid property is set, then the code continues on to the NextButtonClicked then ActiveStepChanged events or not, depending on the validity.
However: When clicking from the SideBar, the ServerValidate event fires, the args.IsValid property is set to true when the data is valid, but the code does NOT proceed to the SideBarClick event. I have no idea why. In every other case the code works correctly.
I tried setting the ControlToValidate property in the CustomValidator, just to see, and that didn't work. I tried setting the ValidationGroup properties in the controls and validator, that didn't help. I'm at a bit of a loss right now. Any ideas would be greatly appreciated.
Thanks! -Thomas
I've got three textboxes containing dates that I need to validate against each other before allowing the user to proceed to the next page. I use a custom validator without the ControlToValidate property set (this will cause the validator to fire whenever a validating event occurs).
<asp:CustomValidator ID="cvRunstartDateTimes" runat="server" OnServerValidate="cvDateTimes_ServerValidate"></asp:CustomValidator>
The event just calls a validating routine that returns a boolean:
protected void cvDateTimes_ServerValidate(object source, ServerValidateEventArgs args)
{
try
{
args.IsValid = RunStart_fnc_ValidatetDatesAndSetTimes();
}
catch (Exception ecvDateTimes_ServerValidate)
{
string strecvDateTimes_ServerValidate = "cvDateTimes_ServerValidate: " + ecvDateTimes_ServerValidate.Message;
}
}
You set the IsValid property to true or false with the returned boolean, and you should be good to go.
It works correctly when the Next button is pressed. The boolean is returned, the args.IsValid property is set, then the code continues on to the NextButtonClicked then ActiveStepChanged events or not, depending on the validity.
However: When clicking from the SideBar, the ServerValidate event fires, the args.IsValid property is set to true when the data is valid, but the code does NOT proceed to the SideBarClick event. I have no idea why. In every other case the code works correctly.
I tried setting the ControlToValidate property in the CustomValidator, just to see, and that didn't work. I tried setting the ValidationGroup properties in the controls and validator, that didn't help. I'm at a bit of a loss right now. Any ideas would be greatly appreciated.
Thanks! -Thomas