In Visual Studio 2008, a JavaScript function, I comment the line,. It’s a usercontrol, and I get it in JavaScript. I want to comment the line, but it didn’t work (
whether I add // or /* */, it doesn’t work).
var user = document.getElementById('<%=UCSeletUser.ClientID %>');
Your problem is that your JavaScript comments are just text like anything else to the ASPX processor. Anything not inside of the script markers is treated as a string literal — it doesn’t know or care that it’s a JavaScript comment. It goes through the page looking for script sections (<% %>) and doing whatever is inside them, regardless of the surrounding text. (Things work slightly differently for databinding code <%# %>, but that’s not relevant to your question.)
If you don’t want that script block to run, you need to either take it out, or comment it out with server-side comments: