Thanks for reading this.
When compiling got this error:
‘ASP.Helpers.Message.DisplayMessage(string, string)’: not all code path returns a value
I have a helper class in App_Code\Helpers\Message.cshtml and this is the content so far:
@functions{
public static string DislayMessage(string x, string y)
{
IF ((x == "yes") && (y == "yes"))
{
return ("something");
}
}
}
in another page it’s being called like this:
@{Helpers.Message.DisplayMessage("yes", "yes")}
Any ideas?
You still need to return something if the condition is false. You might want to return null or something at the end of the function, so as to return something in all cases.