It's becuase you can dynamically create controls in a loop, in master pages etc. and in these situations the framework doesn't force you to give each control a unique id, hence them beign renamed. In your code behind, each control should have a read only ClientId property that you can insert into your javascript if necessary.
I also worked in PHP before .Net, and find going back to old PHP code quite funny with the complete lack of design patterns and principles etc. On 6 Jan, 03:19, BBetances <[email protected]> wrote: > I came from PHP around a year ago. In the past year, i've learned > quite a bit about the .NET Framework, and believe it has much promise. > I like the fact that everything is translated into an intermediate > language, so VB.NET can communicate with C#, and vise-versa. One issue > I have, though, is ASP.NET's handling of JavaScript. I understand that > when the HTML is rendered (Just-In-Time), the names of the controls > change, so adding JavaScript to a control is very difficult. The best > way I know of is to put the JS in the CodeBehind, and use > RegisterClientScriptBlock. With PHP, JS and PHP work together on basic > HTML controls. Now, don't get me wrong; PHP is way too much typing, > not enough thinking. Implementing a basic SQL authentication control > could take a few hours, easy. But what I don't understand is, why > is .NET so incompatible with JS? Running JS at the server kind of > defeats the purpose, doesn't it? > > I'd like to hear your thoughts on this one. I recently started getting > intimate with jQuery, and this small hangup kind of bothers me.
