Custom Validator Control In ASP.NET Web forms | Form Validation | ASP.NET WebForms

 using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;


namespace ANOTHER_EXAMPLE_CV

{

    public partial class WebForm1 : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {


        }


        protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)

        {

            int value = int.Parse(args.Value);


            if (value % 2 == 0)

            {

                args.IsValid = true;

            }

            else

            {

                args.IsValid = false;

            }

        }

    }

}

Above File is ANOTHER_EXAMPLE_CV\WebForm1.aspx.cs






Comments

Popular posts from this blog

AJAX Method Of jQuery AJAX In ASP.NET Web Forms | Learn ASP.NET Web Forms

List Box In ASP.NET Web Forms | ASP.NET ListBox | Web Forms Tutorial | ASP.NET

Display Auto Increment Value In Text Field After Insert To Database ASP.NET