Kendo ASP MVC cshtml automatic code formatting? - visual-studio-2013

I usually use Ctrl+k, Ctrl+d to format my code in Visual Studio 2013, but with the Kendo UI controls in cshtml file, it does not work. Any workaround for this?

Please verify that the kendo.web.min.intellisense.js file is present in the folder which hosts kendo.web.min.js
Explanation can be found here: http://docs.telerik.com/kendo-ui/vs-intellisense
In case , you can't find the intellisense files, search them in vsdoc file in the Kendo installation. then copy them into the project folder with kendo.web.min.js
That should solve the issue.

Related

How to preview a VB6 .frm file?

I have an old VB6 project that is still alive and needs some attention at the moment, but I don't know anything about VB6 and I am just wondering how to preview a .frm file from the project.
I also have the .vbp file if that could be of any help.
I know I can open the files in a text editor (e.g. Notepad++) but is there a way to actually preview the form (like the designer in Visual Studio for WinForms)?
EDIT: Is there a way to make changes to a form?
As you say, you can view .frm and .vbp files in a text editor. These include most of the information about the from.
As far as I know however the only way to actually view and edit the forms is with the Visual Basic 6 IDE. I'm not entirley sure how to best go about acquring a copy howvever.
Re: Edit. You can change the .frm files using any text editor. But that's not going to do you any good without the IDE to compile the changed source.

Visual Studio 2008 doesn't generate itself code for added control in .aspx.designer.cs

I added a control on my .aspx page and set Id and runat=server for it but, it doesn't render on my page when I open it in browser as well it doesn't generate code for it in designer file.
Try that:
1) Remove your_page.designer.cs file.
2) Go to the ASPX page and cut markup, then paste it.
This should force Visual Studio code generation from scratch.
Another try would be check that your control compiles. Sometimes the whole control doesn't compile and you can't add it to the page with success.
Finally, if non of these works for you, you can clean and rebuild your Visual Studio solution.
Matias's appraoch should work another way of doing this is:
Delete the designer.cs file that is causing issues
Right click on the aspx file and "make application" (or something to that effect)
This will regenerate the file.

Visual Studio project character set problem

I had a Visual Studio 2010 MVC 2 project with spanish characters in my views.
I converted the project to Telerik MVC 2 project and now I get weird characters in place of the special characters in my views during execution (they're shown ok in the aspx code in Visual Studio).
E.g.: I used to see this during execution:
I now I see this:
This only happens with the Master Page content.
In Visual Studio: where do I set the encoding used when saving/loading files? The Telerik conversion seems to have messed that up, right?
I don't know how did the Telerik conversion break that. But I've solved the problem this way:
Created a new master page named Site2.Master
Copied the content from Site.Master to Site2.Master
Deleted Site.Master
Renamed Site2.Master to Site.Master

Can Visual Studio 2010 do ".inc" file syntax highlighting?

Can Visual Studio 2010 be configured to do syntax highlighting on ".inc" files? We have numerous large projects with tons of these ".inc" files (asp files) and so changing the file extension to ".asp" is not an option. All I want Visual Studio 2010 to do is treat these ".inc" files just like ".asp" files when it comes to syntax highlighting.
I've tried "Open With..." and selected the HTML Editor, which is the ".asp" default, but that did not work. I tried about every other editor in the list and none of them worked.
I know Notepad++ (among others) can do this, but I would prefer this be done in Visual Studio 2010 - using another IDE or text editor is not the answer I'm looking for here.
In Visual Studio...go to Options -> Text Editor -> File Extension. Type in 'inc' as extension and editor as 'Web Form Editor'. You may need to close then re-open your currently open .Inc pages...Hope this helps
I found both the 'Web Form Editor' and 'HTML Editor' to be less than ideal for me. Both of them appeared to highlight the syntax of the HTML ok, but the VBScript keywords were left in standard black text along with everything else.
While not ideal, I followed the instructions from the other answers, but substitude Visual Basic as the editor type and that worked much more to my liking (as they were include files, there is little HTML in them).
Options -> Text Editor -> File
Extension. Type in 'inc' as extension and set editor as 'Visual Basic'.
Close and re-open any '.inc' files and highlighting should be visible.
Antonio's solution worked for me. I did have to close and reopen files, but after I re-opened them the highlighting was visible. Thanks!
Options -> Text Editor -> File Extension.
Type in 'inc' as extension and set editor as 'Web Form Editor'.
Close and re-open any '.inc' files and highlighting should be visible.
Incidentally, this also works in Visual Studio 2005.
Use the File Extension, Text Editor, Options Dialog Box.
http://msdn.microsoft.com/en-us/library/4k7w5e5s.aspx
-update-
I see the same behavior :-( Will let you know if I find anything.
As a workaround, could you rename all your .inc files to .asp?
This has the added advantage that if a request is made for the inc file directly (highly unlikely but possible; and assuming you have the incs in the web directory), your code will be exposed unlike .asp where it is processed and rendered.
I really wanted to add a comment, because this is not a direct answer, but apparently you need 50 reputation for that.
I've found that in Visual Studio 2005 (again, in Tools -> Options -> Text Editor -> File Extension), both "Web Form Editor" and "User Control Editor" highlight both the HTML and the VBScript.
Amadiere mentioned that "Web Form Editor" doesn't highlight the VBScript in 2010, but maybe it's worth trying "User Control Editor", if that's an option in 2010.
In Visual Studio 2010 and 2012 Express it best works for me when I use "Microsoft Visual Basic" with my .inc files. Nevertheless, it's still not the same as with .asp files as there's no Autocomplete nor IntelliSense (Ctrl+Space, Ctrl+Shift+Space etc.) with the .inc files.
It should be made possible defining that .inc files are to be treated just as .asp files.
I agree with Purple Coder:
You should not name the files containing ASP code as .inc. It is a security risk. Anyone who knows/can guess the filename can open it in a browser and view the actual code inside the file.
But, first of all in my case this is an intranet page and therefore not very risky, as most people there would somehow find the files on the server anyway. I'm also not sure where this naming convention came from. It was there before I started. This was started on Visual Studio 6.
But, to avoid this risk there's a simple solution: add .inc in the Application Mapping of the IIS in the same manner as .asp.
You should not name the files containing ASP code as .inc. It is a security risk. Anyone who knows/can guess the filename can open it in a browser and view the actual code inside the file.

Shortcuts for web controls and HTML snippets in Visual Studio

Consider the feature in Visual Studio 2010 for snippets in the HTML Source view of a web page.
type a control name in plaintext with no markup or brackets!
... e.g. hyperlink.
Then hit Tab
Your web control has been auto-completed for you. It's up to you to fill in the other details that you need.
This works for form as well:
<form action="default.aspx" method="post">
</form>
This looks like a real time saver. This is supported in WebForms and ASP.NET MVC projects.
What other snippets are available in Visual Studio 2010 in the Source view of a page?
For the authoritative list of snippets, check out the VS2010 installation folders where the snippets are stored:
C:\Program Files\Microsoft Visual Studio 10.0\Web\Snippets\HTML\1033
There is one folder for ASP.NET and one for plain HTML snippets.
Also, if you use jQuery a lot, there is a set of jQuery snippets that you can add to Visual Studio as well.
Here are a ton (100's) of the short cuts in Visual Studio right from MSDN:
http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx
The one thing that has been around forever but a lot of people forget about is block selection done by holding down the ALT key and use the mouse to select a block of text. Great when you want to copy/cut/delete a bunch of code that is lined up but you don't want the whole line.
Yeah, this is a really cool new set of snippets in VS2010. Here are the articles I used to learn it:
Walkthrough: Using HTML
Snippets
Using HTML Code Snippets in Visual
Studio 2010

Resources