ASP.NET C# Writting a string into html to validate ?

Posted by Yardstermister on Stack Overflow See other posts from Stack Overflow or by Yardstermister
Published on 2010-05-13T22:49:59Z Indexed on 2010/05/13 22:54 UTC
Read the original article Hit count: 212

I am pretty new to ASP.NET and C# I have spent the day learning the basics of the ASP.NET Membership provider I have built all my validator but are getting stuck at outputting my error message on the page.

 private void LogCreateUserError(MembershipCreateStatus status, string username)
{
    string reasonText = status.ToString();

    switch (status)
    {
        case MembershipCreateStatus.DuplicateEmail:
        case MembershipCreateStatus.DuplicateProviderUserKey:
        case MembershipCreateStatus.DuplicateUserName:

            reasonText = "The user details you entered are already registered.";
            break;

        case MembershipCreateStatus.InvalidAnswer:
        case MembershipCreateStatus.InvalidEmail:
        case MembershipCreateStatus.InvalidProviderUserKey:
        case MembershipCreateStatus.InvalidQuestion:
        case MembershipCreateStatus.InvalidUserName:
        case MembershipCreateStatus.InvalidPassword:

            reasonText = string.Format("The {0} provided was invalid.", status.ToString().Substring(7));
            break;
        default:
            reasonText = "Due to an unknown problem, we were not able to register you at this time";
            break;

    }

   //CODE TO WRITE reasonText TO THE HTML PAGE ??

}

What is the best way to output the varible result onto the page as I have relied upon the built in ASP:Validators untill now.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET