using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication3
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
CustomValidator1.Validate();
}
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
if (RadioButton1.Checked == false && RadioButton2.Checked == false)
args.IsValid = false;
else
args.IsValid = true;
}
}
}
Here is the code I used to program my server side custom validator. I'm having trouble understanding how this works because if I take it out of the IsPostBack "if", it shows up in the summary when I start up the page but when I click a button it doesn't work. Anyone know what might be wrong?
Also as some side info, what is the major difference between server side and client side validation in terms of this type of validation ?