Let's say I have a list of strings. I have a TextBox and a ADD button which adds no null values to the list.
There's also a NEXT button on the page. When the Next Button is clicked, the list's content is displayed on another page. I'd like to proceed to a Validation so that the user can get to the result page only if the list is not empty (contains at least one element).
Also, I'd like the error message to be displayed by a Summary Validation to keep a standard way of displaying errors. Here is the code I use to check which button was clicked and the number of elements in the list.
protected void UploadWizard_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
string ctrlID = ObjectFinderHelpers.GetPostBackControl(this.Page).ID;
if (ctrlID == "StepNextButton" & KeyWordList.Count == 0)
//Do something to keep the user on the same page
//So that he can add at least one element to the list
}
Thanks for helping
You can use Customvalidatorcontrol to do custom validation,implement the OnServerValidate to do custom validation. This can be integrated with the Validation Summary control as any standard validation control.