ASP.NET MVC markup in VS2008 script has warnings with "expected expression" - javascript

I've searched SO and have been unable to find this question asked before, but I can't believe I'm the only one running into it. If this is a duplicate, please point me to the original question.
In VS2008, I have some ASP.NET MVC markup in a script section on some of my pages. I end up getting "expected expression" warning squiggles on the ASP.NET MVC markup even though the jQuery/JavaScript in the preceding code is valid. It only happens on the markup.
This doesn't prevent the page from rendering, everything works fine. It is more an annoyance than anything else. I've installed VS2k8 SP1 along with the Intellisense hotfix and it still happens. It also happens whether I'm running R# 4.5 or the 5.0 EAP.
Suggestions or should I just pick my battles when it comes to VS 2008?
Screenshot: My apologies, I could have sworn I added a screenshot to this question.
http://www.twitpic.com/z6bxj

The VS designer is not good at handling cases where your markup jumps between server-side and client-side script.
Sometimes adding <%=""%> at the top helps, as per this post: http://forums.asp.net/t/1384577.aspx.
The VS designer also seems slow to pick up changes, re-parse and remove error squiggles.
In your case I think it's trying to parse that line as Javascript but it's obviously not. If you're nuts about removing the errors you would have to re-factor the code, eg generate the entire JS script as a server-side string and write it out.
I've learned to view error squiggles as advice only, and once the page is stable and working just ignore them.

Related

Sublime text editor 3, Not saving But saving

I spent around 6-7 months, trying to learn code a while ago.
Learning the basics of HTML, CSS, javascript, jQuery and a few others.
I have had a break from it for a while as it was
confusing me & other things in life came up.
Now I'm ready to start again.
I have created a simple HTML file & trying to manipulate it via Javascript.
But each time I try and save the javascript file I am getting the following error (Shown in Sublime).
[WinError 2] The system cannot find the file specified
[cmd: ['esvalidate.cmd', '--format=sublime', 'C:\Users\ManDoesNotSubmit\Desktop\Es6NorwichAds\Es6NorwichAdverts.js']]
[dir: C:\Users\ManDoesNotSubmit\Desktop\Es6NorwichAds]
[path: C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\ProgramData\Oracle\Java\javapath;C:\php;C:\WINDOWS\System32\Wbem;C:\PHP]
[Finished]
It is confusing me because when I close sublime & re-open the document,
my new changes have been saved but it is still throwing this error....
I have searched forums, Youtube etc.
But all the responses I have found are regarding Python, Build systems & syntax errors.
Not the specific problem I am having.
I am running windows 10, on a cheap laptop.
I have checked the system environment variables & JS is present in both the extensions & path sections, so I cannot understand why it is throwing an error..
I am opening the file directly into sublime, from my desktop so If it could not find the file, it simply would not load the small amount of script I have written..
Any help would be appreciated.
Sounds like you're missing the sublime-jsvalidate npm package. See here
To be more precise: the error you're getting is about esvalidate.cmd not existing, not the file you're trying to save.

visual studio inline javascript obfuscator

Does anyone know a plugin or tool that would obfuscate my inline javascript (in script block) in my .aspx pages when publishing? It wouldn't do any harm, if the plugin also removed xml comments/html comments, empty lines and and so on.
Its no security question ;) I just don't want users to be able to see comments and read the code straight away - and maybe have everything look a bit more pretty in the end.

Can't Generate Sitemaps for sites including Javascript and JQuery

I am trying to generate a sitemap for two of my sites but both online and local software doesn't work. The site www.xsitemap.com says that the root URL is a bad URL. All others, including my software WebCEO simply run and produce nothing.
I have several other sites for which the sitemap generators work well. These are the only two sites I have that include JavaScript and jQuery - hence the tags.
It's probably a stupid error by me but I'm really baffled and could certainly use some help.
It's worth saying that I've just had WebCEO produce an error saying that there is a script error (a missing ')' on line 2459). There are 439 lines of code so it occurs in one of the includes but more likely that I've got an extra opening '(' in my code. The sites work ok though.
Offhand I did not encounter any problems using A1 Sitemap Generator (You can add support for searching for links in Javascript in "Scan website | Crawler options" if you disable "easy mode")
The only thing I can think of causing problems (not that I encountered them) would be if you used AJAX somehow. (At least if you did not also then implement Google's http://code.google.com/web/ajaxcrawling/ proposed solution to that.)

Problem porting WordPress Editor to a non-WP application

I like the look and feel of the WordPress editor (version 2.7), and I would like to use it in another web application that is written in ASP.NET. I've used TinyMCE before, and I've even extended it in the past. However, I can't seem to get the Wordpress configuration to work!
I've downloaded the entire WordPress package and taken the TinyMCE code (from the "js" folder) and put it in my web site. It ends up giving me an error on the following line of tiny_mce.js
return f.apply(s||this,Array.prototype.slice.call(arguments,2))
'undefined' is null or not an object.
Now, I've carefully made sure that the steps of execution are identical with the WordPress demonstration site that I've based this from.
I'm not a Javascript newbie (at all), but I can't seem to figure out why this is not working. Has anybody tried to do this before? What am I missing?
A demo of what I am talking about is here (username="admin", password="demo"). View the source, I have the three parts of Javascript that are (seemingly) required to power the editor.
Something of a stab in the dark, but I'm suspecting that there's a dependency on WP's prototype.js and you didn't bring that over with TinyMCE.
If you are able to determine which bit is undefined that might give you a clue. I tried looking at the demo with firebug, but tinymce.js was all one line, so I gave up trying to find that code.
Try putting in either some console.log() if you have firebug, or alert()s before that line, and try to see what f,s,this,arguments etc are when yu get the error, then do the same thing with a vanilla WP install and see the difference?
I suggest including the tiny_mce_src.js istead of the minified version, this way you can use firebug to debug and receive helpfull information.

JScript intellisense with ScriptManagerProxy

I've got a problem making my ScriptManagerProxy expose registered scripts.
When I add a ScriptManager, everything works as expected and the scripts are reflected correctly, but whenever I change it to a ScriptManagerProxy, every script, even the MicrosoftAjax.js, dissapears from the intellisense.
I believe there is some sort of bug with the proxy, but could anyone shed some light on how I can fix this. It's getting quite tedious changing the ScriptManager to and from a proxy all the time.
By the way, I'm using user controls with embedded script resources, if that's of any importance (it all works with the regular ScriptManager, so there's nothing wrong with the code).

Categories

Resources