I don't know anything about PHP, but I figured I'd point out something on this subject, as I just ran across the issue.
When you're using server-side tags as mentioned above (ClientID references), you can't stick your javascript in its own file; it has to be on the page itself, (and the masterpage and the code-behind, as pointed out earlier). I tried to stick similar code with these tags - I'm validating whether info was imputed in texboxes - in a separate file and reference the file. It went through with no validation, as if it didn't recognize the file at all, despite setting up the reference to the file correctly. I put the same code back on the original page, and it worked. If anyone could prove differently, let me know, as I don't like looking at tons of javascript before I even get to my actual code. On Jan 6, 3:31 am, CK <[email protected]> wrote: > 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.- Hide > > quoted text - > > - Show quoted text -
