Javascript with Visual Studio 2013
-
Can I use javascript in web forms project which has master pages and content pages. I know it can be used but the code written in script tag or style tag is not executed. I have tried too many solutions I get from sites like stakoverflow and codeproject because I am facing this problem since 15-20 days, even there is no error in the syntax. But the problem is script is not executed.
-
Can I use javascript in web forms project which has master pages and content pages. I know it can be used but the code written in script tag or style tag is not executed. I have tried too many solutions I get from sites like stakoverflow and codeproject because I am facing this problem since 15-20 days, even there is no error in the syntax. But the problem is script is not executed.
A couple of things. 1. This is the C# forum, so you're not going to have much luck here. 2. You haven't shown any code. No one will be able to help you identify a problem with your code if you haven't shown it.
-
Can I use javascript in web forms project which has master pages and content pages. I know it can be used but the code written in script tag or style tag is not executed. I have tried too many solutions I get from sites like stakoverflow and codeproject because I am facing this problem since 15-20 days, even there is no error in the syntax. But the problem is script is not executed.
Your problem is that you're not appreciating that javascript runs on the client using the rendered html, and what you see in visual studio aspx files is not what is rendered to the client. .net will change your control IDs so if you refer to IDs in your js you need to use the ClientID property of the control to get the proper ID, or use static ids if that is suitable (it won't always be); ASP.NET 4.0 Client ID Feature[^] Other things you need to bear in mind are code paths and how you refer to your js files in relation to your other files. There is no single trick to this, it mainly involves having a good understanding of the framework and using best practises in your coding, and tackling individual problems as you encounter them.