M
Martin
Hi,
I am implemeting a form in asp.net.
The form is quite large and the validation is reasonably complex, so I have
decieded to implement my own validation rather than use any custon
validators,
so I have a button on the form and the "causes validation" property is set
to true.
I have overridden the "Validate()" like so
public override void Validate()
{
string functionName = "Validate - page";
Trace.Warn(functionName,"Just entered function");
Trace.Warn(functionName,"Just exiting function");
base.Validate();
}
and I am checking "Page.IsValid" in my button handler like so (please note
that it was neccessary to call the base class from the validate method in
order for me to even check the "Page.IsValid" property.)
private void Button1_Click(object sender, System.EventArgs e)
{
string functionName = "Button1_Click - page";
Trace.Warn(functionName,"Just entered function");
if (Page.IsValid == true)
{
Response.Write("Page is Valid!");
}
else
{
Response.Write("Some of the required fields are empty");
}
Trace.Warn(functionName,"Just exiting function");
}
however i can't find a way to set the IsValid property (nor can I seem to
override it).
The asp.net docs say this property is readonly so I guess that I can't do
this, which makes me wonder if I am implemeting my validation incorrectly.
can anybody offer some advice about validating in this method.
thanks in advance.
cheers
martin.
I am implemeting a form in asp.net.
The form is quite large and the validation is reasonably complex, so I have
decieded to implement my own validation rather than use any custon
validators,
so I have a button on the form and the "causes validation" property is set
to true.
I have overridden the "Validate()" like so
public override void Validate()
{
string functionName = "Validate - page";
Trace.Warn(functionName,"Just entered function");
Trace.Warn(functionName,"Just exiting function");
base.Validate();
}
and I am checking "Page.IsValid" in my button handler like so (please note
that it was neccessary to call the base class from the validate method in
order for me to even check the "Page.IsValid" property.)
private void Button1_Click(object sender, System.EventArgs e)
{
string functionName = "Button1_Click - page";
Trace.Warn(functionName,"Just entered function");
if (Page.IsValid == true)
{
Response.Write("Page is Valid!");
}
else
{
Response.Write("Some of the required fields are empty");
}
Trace.Warn(functionName,"Just exiting function");
}
however i can't find a way to set the IsValid property (nor can I seem to
override it).
The asp.net docs say this property is readonly so I guess that I can't do
this, which makes me wonder if I am implemeting my validation incorrectly.
can anybody offer some advice about validating in this method.
thanks in advance.
cheers
martin.