Custom validation

  • Thread starter Thread starter Morten
  • Start date Start date
M

Morten

Hi!

I tried to post this in the csharp group but didn't get an answer so I
thought that maybe someone here will know how to do this - just ignore the
fact that the code is csharp and not VB.

I've been experimenting with server side custom validation and I can't make
it work.

I have a text box which I'd like to validate by sending the content to a web
service which will check it and return 0 or 1. I've added a custom validator
control in VS .Net 2003. The code looks like this:

<asp:CustomValidator id="CustomValidator1" runat="server"
ControlToValidate="CVRNummer" ErrorMessage="TEST"></asp:CustomValidator>

By double-clicking the control the follwoing was added in the code-behind
file:

private void CustomValidator1_ServerValidate(object source,
System.Web.UI.WebControls.ServerValidateEventArgs args)
{
}

I've tried to add all sorts of things to this Sub to make something happen
but so far nothing has worked. My last attempt was this:

private void CustomValidator1_ServerValidate(object source,
System.Web.UI.WebControls.ServerValidateEventArgs args)
{
Label3.Text = "TEST";
}

which unfortunately didn't give me the expected result. Can someone help me
out here?

Best regards

Morten
 
Hi!

I've tried posting to the ASPNET group you suggested.

Thanks for answering

Morten
 
Back
Top