Hello I want to validate the input, so the method for count words is the following :
public static string validateisMoreThanOneWord(string input, int numberWords)
{
try
{
int words = numberWords;
for (int i = 0; i < input.Trim().Length; i++)
{
if (input[i] == ' ')
{
words--;
}
if (words == 0)
{
return input.Substring(0, i);
}
}
}
catch (Exception) { }
return string.Empty;
}
Where I put this method, so when the method return empty after the validation, the page wouldnt postback (like RequireFieldValidator on AjaxToolKit)
Thanks!