470,624 Members | 2,476 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,624 developers. It's quick & easy.

dropdownlist onchange squiggly

hey all,

<asp:DropDownList id="DropDownList1" runat="server" onchange="Test();">

can someone please tell me why the onchange has a squiggly and if there is a
better way to access the client-side change event for the drop-down list?

The message is saying it's not a valid attribute of the drop down list
element but yet it still works for me?

thanks,
rodchar
Oct 11 '07 #1
4 2489
Hello rodchar
<asp:DropDownList id="DropDownList1" runat="server" onchange="Test();">

can someone please tell me why the onchange has a squiggly and if there is
a
better way to access the client-side change event for the drop-down list?
The message is saying it's not a valid attribute of the drop down list
element but yet it still works for me?
Yes, you catch this message, but looked to the rendered code too?
The point is:
All attributes where not available in the control, throw such a message.
But ASP.NET do render all that attributes AS-IS to the Html Code.
In this point, this is not a fail in any case, but rather a possible
improvement for a future version of Visual Studio :-)

Another way to add "custom" attributes to your control is wrote them in your
codebeside like:
---------
this.dropTest.Attributes.Add("onchange", "foo(this.value);");
---------

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
Oct 11 '07 #2
this.dropTest.Attributes.Add("onchange", "foo(this.value);");
what's the best way to find all the possible client-side events for any
control?

"Peter Bucher [MVP]" wrote:
Hello rodchar
<asp:DropDownList id="DropDownList1" runat="server" onchange="Test();">

can someone please tell me why the onchange has a squiggly and if there is
a
better way to access the client-side change event for the drop-down list?
The message is saying it's not a valid attribute of the drop down list
element but yet it still works for me?
Yes, you catch this message, but looked to the rendered code too?
The point is:
All attributes where not available in the control, throw such a message.
But ASP.NET do render all that attributes AS-IS to the Html Code.
In this point, this is not a fail in any case, but rather a possible
improvement for a future version of Visual Studio :-)

Another way to add "custom" attributes to your control is wrote them in your
codebeside like:
---------
this.dropTest.Attributes.Add("onchange", "foo(this.value);");
---------

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
Oct 11 '07 #3
Hello rodchar
what's the best way to find all the possible client-side events for any
control?
surfing around :-)
- http://de.selfhtml.org/javascript/sp...r.htm#onchange

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
Oct 11 '07 #4
Thanks Peter, I appreciate the dialog which helped.
rod.

"Peter Bucher [MVP]" wrote:
Hello rodchar
what's the best way to find all the possible client-side events for any
control?
surfing around :-)
- http://de.selfhtml.org/javascript/sp...r.htm#onchange

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
Oct 11 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Bob N | last post: by
1 post views Thread by chongo | last post: by
3 posts views Thread by =?Utf-8?B?RGVlcGE=?= | last post: by
11 posts views Thread by harold.gimenez | last post: by
3 posts views Thread by =?Utf-8?B?Y21lZWsxXzE5OTk=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.