ErrorMessage

K

Kenny

Hi,
Is it possible to call a function from a control, for e.g
<asp:requiredfieldvalidator id="test" errormessage="ccc" />

Is it possible for me to create a FormatErrorMessage function if I want to
change the text of the message.

<asp:requiredfieldvalidator id="test" errormessage="<%
FormatErrorMessage('test','Invalid input') %>" />

public string FormatErrorMessage(string s, string t)
{
s.ErrorMessage = "Required Fields: " + s + "-" + t;
}

Thanks.
Kenny Kee
 
D

David Waz...

That's all a standard part of the validator controls. Nothing too fancy to
do this.

<asp:RequiredFieldValidator ID=Test ...blah blah... />

code behind:
protected Test as RequiredFieldValidator...


Private Sub Test_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Test.Load

Test.ErrorMessage = "Anything you want to say here"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top