ErrorMessage

Discussion in 'ASP .Net' started by Kenny, Jul 5, 2003.

  1. Kenny

    Kenny Guest

    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
    Kenny, Jul 5, 2003
    #1
    1. Advertising

  2. Kenny

    David Waz... Guest

    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



    "Kenny" <> wrote in message
    news:...
    > 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
    >
    >
    David Waz..., Jul 6, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Edmilson

    Errormessage in CustomValidator

    Edmilson, Jul 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    388
    Edmilson
    Jul 10, 2003
  2. Arjen
    Replies:
    2
    Views:
    345
    Michal A. Valasek
    Aug 2, 2003
  3. =?Utf-8?B?RG9ydGU=?=

    Reset errormessage on CustomValidator

    =?Utf-8?B?RG9ydGU=?=, May 7, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    394
    =?Utf-8?B?RG9ydGU=?=
    May 7, 2004
  4. Christina N
    Replies:
    0
    Views:
    352
    Christina N
    Jun 21, 2004
  5. Phil Winstanley [Microsoft MVP ASP.NET]

    Re: IIS errormessage referrs non-existing linenumber

    Phil Winstanley [Microsoft MVP ASP.NET], Jun 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    327
    Christina N
    Jun 21, 2004
Loading...

Share This Page