I have an EditCustomerRecord page that has Permanent Address and a Mailing Address. When the user unchecks the "Same As Permanent Address" check box, it should prompt the user to enter in the mailing addres when the user tries to save the data.
I added this using the code telescope.
Code:
/// <summary>
/// The standard event handler for ApplicationEvent events.
/// </summary>
/// <seealso cref="T:BaseClasses.IEventProducer" />
/// <seealso cref="T:BaseClasses.ApplicationEventArgs" />
public override void OnApplicationEvent(ApplicationEventArgs args)
{
if (ApplicationEventArgs.EventTypes.UpdateData == args.EventType)
{
if (!this.Same_As_Permanent_Addr.Checked)
{
if ((MailingZipCode.Text.Length > 0) && (MailingAddress.Text.Length > 0)
&& (MailingCity.Text.Length > 0) && (MailingState.SelectedIndex > 0))
{
base.OnApplicationEvent(args);
}
else
{
MiscUtils.RegisterJScriptAlert(this, "CANNOT_SAVE_MESSAGE", "Please fill out the Mailing Address.");
return;
}
}
}
}
Initially I had the page set to redirect to the same page with a querystring parameter, and I thought that was causing the problem. I changed that and said stay on the same page. Even after doing I cannot get the error message to display. What is it that I need to do more to get the error message to display and stay on the same page?
Thanks
~KD