ErrorMessage

  • Thread starter Thread starter Kenny
  • Start date Start date
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
 
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
 
Back
Top