ASP.NET code formatting tool - asp.net

Is there any tool for Visual Studio 2008 which can reformat ASPX code to make it more presentable (eg insert line breaks, format the lines so they wrap when necessary, etc)?
Thanks

Have you tried hitting Ctrl+K+D? Is this what you're referring to?

http://blogs.msdn.com/markhsch/archive/2008/01/10/visual-studio-tip-autoformat-your-code.aspx
To have Visual Studio fix it all up nice and tidy for you, select the text, hold CTRL and hit K followed by F (CTRL+K-F). What I usually do is do a CTRL-A to select all text then do the CTRL+K-F combo. Voila!

You can also do it from the menu Edit > Advanced > Format Document or toolbar.
alt text http://img148.imageshack.us/img148/8872/formatdoc2.png

There are actually a number of tools dedicated to code formatting that you might want to take a look at. Visual Studio's formatting capabilities are actually quite limited, and a lot of projects I have worked on use one of these external tools.
Good luck!

This may not be directly related to your issue, but DevExpress has a free product CodeRush Express that will not only help with tidying but has a great interface for refactoring. Here is a link to their demo video. I've used their products for a few years and they really up your productivity.

After 11 years there is still no tool that does it right. All online formatters I found dont cope well with ASP (.NET/Core/Blazor) tags, and VS20xx (even the latest 2022) doesn't deal with tags from custom controls, it formats all, except for sections within custom tags. In my case, 90% of the aspx files.

Related

Paste code in html editor

I need a tool where I can paste code and view it on a web page.
I tried TinyMCE 4.x. It works fine, but I found one problem: Indentation is not kept when I paste code from Visual Studio. I googled, but I cant find a solution to that,
I tried fckeditor a couple of months ago. I has a syntax highlighter, but if I recall correctly, it had the same problem with indentation.
I need the tool to help me with three things:
Write plain text
Paste code mainly from Visual Studio
Upload image
Most of the google hits are from 2009-2010, so what do I use 2013?
Should I abandon the 'famous' editors and go for something in this 4 year old article:
http://www.1stwebdesigner.com/css/16-free-javascript-code-syntax-highlighters-for-better-programming/
Im building this with asp.net 4.5
Or maybe just sum it up with one question: How did you get this kind of requirement up & running?
Thanks
Perhaps you want also to try other text editors like ckeditor (references: http://drupal.org/project/ckeditor, http://drupal.org/project/ckeditor), you may also like to use nicEdit which I'm also using right now (http://nicedit.com/), or you may want to use WYSIWYM Markdown Editor[wmd] (https://github.com/derobins/wmd, http://code.google.com/p/wmd/) like this one on stack overflow.. And another one Rich Text Editor [RTE] (demo is here: http://www.kevinroth.com/rte/demo.htm, main site is here: http://www.kevinroth.com/rte/).

Can sites built with DW be worked on without DW?

I've got a prospect whose site was just built, but the forms don't work. The forms seem to be using a DW Extension. We don't build in DW, so I'm not familiar with how it works. If a site is built in DW, is it limited to only DW-related fixes/solutions?
Dreamweaver is just a GUI for designing and developing HTML (etc;) pages, sites.
Many devs actually utilize nothing more than an enhanced Notepad application (like Notepad++). Personally I consider Dreamweaver a crutch for people that develop in it from day 1, you take it away and they don't know anything because they rely on the program. Which is fine for most work until they run into issue where they have to solve a problem themselves.
I don't hate dreamweaver, I just don't use it as my Notepad++ is sufficient for all my PHP, HTML, CSS, JSP, etc dev
Extension
You probably mean, a javascript library of some sort to validate the forms? If so you could gut those out (or keep them) and use jQuery, or anything you are comfy with.
Yes, absolutely. Once Dreamweaver generates the code anyone who is familiar with whatever language it is in can work on the file. Dreamweaver itself is not required for anything, but if you do use it you can take advantage of the wizards and what not.
But any text editor can edit pages generated by WP.
One note of caution: DW uses regular expressions to check its code and look for patterns that correspond to the various wizards. If you edit the code, it may break that check and the behavior will no longer appear in the appropriate panel. Everything will still work fine but you will no longer be able to edit via wizards.

wysiwyg user help authoring tool to work with qthelp?

We need to compile to QtHelp (.qch and .qhc). I'm wondering what tool/toolchain would be easiest for this? We'd like a WYSIWYG help authoring tool as our starting point, then run the output from that through whatever we have to to get QtHelp.
We have used Help & Manual in the past, and that's the kind of WYSIWYG interface we're looking for in a help authoring tool. But we need the toolchain to produce simple html pages (one per help topic) that we can use with qhelpgenerator or qcollectiongenerator, as well as create the .qhp's (at least the table of contents and the keywords sections) and .qhcp to generate the .qch's and .qhc. I'm not seeing how Help & Manual can fit into this.
We've looked briefly at Sphynx, but it seems it has extremely limited options for text formatting. For example, it doesn't look like there's any way to change the font, font size, font color, etc. for a section of text. It appears to be actually impossible to have text that is both bold and italic. Looks great for developer documentation, but seems to be missing basic stuff for authoring a user help file. Please correct me if I somehow missed the basic text formatting features!
So, what WYSIWYG help authoring tool do you recommend, and what is the path from that tool to .qch's and a .qhc?
Looks like Help and Manual will work after all! Here's the sequence we're looking at now. If please comment if you see any problems or improvements that can be made.
In Help & Manual (tested with version 5.5.1 Build 1296 professional license), in the Project Explorer, in the Configuration section:
Go HTML Page Templates\Default. In the HTML Source Code tab, comment out the section.
Go to Publishing Options\Web Help.
In Layout, select No frames, no scripts.
In Navigation, we don't need anything checked - although if there is a way to control the format of the value of KEYWORD_INDEX so we could copy and paste directly into our .qhp, that would be great! I haven't found a way to do that, so we plan to maintain keywords directly in the .qhp.
Similarly, Table of Contents is also irrelevant, unless we can control the format we'll have to maintain the toc directly in the .qhp.
In Popup Topics, we are set to HTML encoded topics. Not sure if this is necessary.
That's all the settings we have to change. Create help content in H&M as normal, then to publish Webhelp. This creates a separate .htm file for each topic.
In the same folder as the .htm's, we create our .qhp and .qhcp files, and run qcollectiongenerator to produce our .qhc, which we then display with Qt Assistant. See http://doc.qt.nokia.com/4.7/qthelp-framework.html for help with the Qt side of this toolchain.
Again, it would be great if we could find a way to set up H&M to create the toc and the keywords in the format required for the .qhp and we could just paste them into the .qhp (or for that matter, maintain the .qhp in that template also). Another option would be to write a script to convert from what H&M creates for toc and keywords to what the .qhp requires. If you do that and don't mind sharing, please post the code!
Some benefits we find using H&M to solve this problem:
multiple documenters can work simultaneously, and source is stored as text files in Subversion, so it is versionable and you can compare changes.
easy WYSIWYG creation of help topics
can handle all kinds of text formatting and links. For example, in an end-to-end test of features to see what features of H&M would work in our end product (.qhc viewed in Qt Assistant), I was surprised to see Qt Assistant even handling hotspots in an image linking to other topics/anchors.
the .qhc is integrated into Qt so you have good control of your help from within your Qt app.
Again, if anyone has a better solution or improvements to this one, please post!
use Helpinator 3 Professional it's generat chm qt javahelp word pdf files easly ..
You might consider the HelpNDoc help authoring tool which has a WYSIWYG editor and can generate Qt Help files out of the box. Generated source files can optionally be kept for manual editing and manual compilation.

Is there any HTML wysiwyg editor?

I wonder whether there is any good WYSIWYG editor when it comes to editing complex HTML pages generated from ASP.NET, PHP, GWT or anything else. I've tried a lot of WYSIWYG tools, but after a certain point I always end up with manually editing the HTML source code or CSS to fix different issues. The editors I've tried are never compatible with the ASP.NET/PHP/etc code I'm writing.
Edit: I have used Visual Studio for a few years to do ASP.NET development. After a while, it always comes to the point where I can't even open the pages and user controls because they rely on so many things which aren't available in debug time.
You're not going to get anything that is perfect. You're almost always going to have to tweak the mark-up by hand at least a little bit.
Your best bet would probably be Adobe Dreamweaver for PHP and Visual Studio (Visual Studio Web Developer Express is free) for ASP.NET.
I love VS, but I'd rather make sweet love to a hedgehog than use the HTML editor. Expression Web does a much better job editing HTML.
Personally I think that Visual Studio is the best for ASP.NET, although Expression Web also seems to be pretty good.
But I personally I think it's the best for you to start writing more code and using the WYSIWYG part less and less.
With Web applications it's all about the way they're displayed in the browser and I think that the browser is the tool which should be used for testing the GUI.
I agree, I have Expression Web right now and it works well. You can move stuff around in design view but will of course, as stated above, have to render the code manually. But it works if you wanna see the changes you have made. I would always of course view it in the browser and not just rely on the design view. Also W3Schools is a great tool.
WYSIWYG editors for complex web site/applications just never measure up IMHO.
The problem comes down to wanting control of the HTML/CSS markup, yet also the flexibility to create a GUI via drag-n-drop. (the 2 are almost polar opposites)
Take a very simple example.
In WYSIWYG mode, I type/create (pretend that World is on the line right after Hello (the Markdown editor forces me to add an extra line break)):
Hello
World
What HTML should the editor create?
Hello<br/>
<b>World</b>
<p>Hello</p>
<p><strong>World</strong></p>
<div>Hello</div>
<div><span style="font-weight:bold;">World</span></div>
<span class="abcNormal">Hello</span>
<br/>
<span class="abcBold">World</span>
(and a zillion more possibilities)
I still think the best thing you can have is an editor/IDE that understands your component/tags and provides auto-completion and code-assist/intellisense - paired up with a very quick deploy option to test changes ASAP in real browser(s)
Take a look at BBCode Editor
http://richtexteditor.com/demo/bbcode.aspx
This example shows a simple BBCode formatter for the Editor.

An Alternative to VS 2008 Designer Screen

I thought the web page designer screen in 2005 was mediocre until I used the one in 2008 which I think is bad. There is an interesting white paper here:
http://www.west-wind.com/weblog/posts/484172.aspx
I've gotten very used to these WYSIWYG designers over the years, but I am looking now for a new way.
I make business web apps which call for data entry forms. I don't need anything particularly artistic, but I do need to be able to line up text boxes etc on input forms so that they lkook orderly and are convenient for the user. I use Telerik controls, and my skills with CSS are approaching passable.
People often mention that they don't use the designer, but they rarely state what approach they DO use.
What are some of the alternatives to using the VS designer?
I don't use any WYSIWYG editor for WebForms. I've found that there are no good WYSIWYG editors for HTML, let alone ASP.net.
My suggestion is to learn enough HTML/CSS/ASP.net that you care code entirely without the WYSIWYG editor. If you can't or don't want to do this, then you'll just have to put up with a marginal editor.
I think a lot of the time when people say they don't use the designer they just use the source view the majority of the time. The reason for this is the designer often generates extra HTML code you don't need or it can even be a hindrance such as adding extra css styles directly to your page, I have also had it create technically invalid html by putting bold tags in the wrong places inside a table (Although it displayed ok in most browsers).
If you are not comfortable with just the source yet, I suggest split view then at least when you are using the designer you can see what it is creating and edit to get it perfect.
Don't trust the designer over seeing your website in a few different browsers.

Resources