Attribute 'onchange' is not a valid attribute of element 'TextBox'

Discussion in 'ASP .Net' started by Joe Kovac, May 2, 2007.

  1. Joe Kovac

    Joe Kovac Guest

    Hi!

    Using:

    <asp:TextBox ID="TextBox1" runat="server"
    onchange="onchange()"></asp:TextBox>

    I get:

    Warning 1 Validation (ASP.Net): Attribute 'onchange' is not a valid
    attribute of element 'TextBox'.

    How to avoid this warning? What should I do to "fix" it?

    Possibly you styles or like that???

    Thanks

    Joe
    Joe Kovac, May 2, 2007
    #1
    1. Advertising

  2. Joe Kovac

    Mark Rae Guest

    "Joe Kovac" <> wrote in message
    news:6f308$46388a67$3e63c322$...

    > Using:
    >
    > <asp:TextBox ID="TextBox1" runat="server"
    > onchange="onchange()"></asp:TextBox>
    >
    > I get:
    >
    > Warning 1 Validation (ASP.Net): Attribute 'onchange' is not a valid
    > attribute of element 'TextBox'.


    That's because you're using a webcontrol, which doesn't have an onchange
    method.

    > How to avoid this warning? What should I do to "fix" it?


    In code-behind:

    TextBox1.Attributes.Add("onchange", "onchange();");

    Also, see my previous message advising against this... :)

    --
    http://www.markrae.net
    Mark Rae, May 2, 2007
    #2
    1. Advertising

  3. Joe Kovac

    Joe Kovac Guest

    Mark Rae wrote:
    > "Joe Kovac" <> wrote in message
    > news:6f308$46388a67$3e63c322$...
    >
    >> Using:
    >>
    >> <asp:TextBox ID="TextBox1" runat="server"
    >> onchange="onchange()"></asp:TextBox>
    >>
    >> I get:
    >>
    >> Warning 1 Validation (ASP.Net): Attribute 'onchange' is not a valid
    >> attribute of element 'TextBox'.

    >
    > That's because you're using a webcontrol, which doesn't have an onchange
    > method.
    >
    >> How to avoid this warning? What should I do to "fix" it?

    >
    > In code-behind:
    >
    > TextBox1.Attributes.Add("onchange", "onchange();");


    I guess this way MS wants to point out clearly, that you use non MS
    properties. Putting it to the .aspx page works, but produces a not
    beautiful warning.


    > Also, see my previous message advising against this... :)


    See my comment on your comment of your previous message ;-)
    Joe Kovac, May 2, 2007
    #3
    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. anonymous
    Replies:
    1
    Views:
    5,952
  2. =?Utf-8?B?TWFyaw==?=
    Replies:
    4
    Views:
    632
    =?Utf-8?B?TWFyaw==?=
    Dec 14, 2006
  3. perspolis
    Replies:
    1
    Views:
    2,563
    Mark Rae
    Jan 23, 2007
  4. CdnRebel
    Replies:
    4
    Views:
    1,972
    CdnRebel via DotNetMonster.com
    Jul 4, 2007
  5. Dan
    Replies:
    2
    Views:
    411
Loading...

Share This Page