ASPX Edit Helper Add-In For Visual Studio

The ASPX Edit Helper is an add-in for Visual Studio 2005 for those who like to type ASPX markup themselves instead of using the visual designer. It’s a very simple add-in but pretty handy if you prefer to type ASPX. (It also works with Visual Studio 2008.)

ASPX Edit Helper does just two things:

  1. Fill in runat=”server” id=”random_id” when you type a server control (e.g., asp:Label).
  2. Insert ASPX snippets when you type a short code.

Usage Type 1

Type <asp:Label and press Enter. The add-in will replace it with:

<asp:Label runat=”server” id=”asp_Label2943″ />

The add-in will also highlight the ID attribute value so you can immediately type a new ID for the control.

Alternatively, type <asp:Label></asp:Label> and press the Up or Down arrow.

Usage Type 2

Type a short code such as /lbl or /txt and press Enter. The add-in will replace it with the corresponding ASPX snippet:

<asp:Label runat=”server” id=”asp_Label2943″ />

<asp:TextBox runat=”server” id=”asp_TextBox2943″ />

The short codes and snippets are defined in the AspxEditHelperSnippets.xml file which you can crack open and modify as needed. The format for a short code must be a slash (/) followed by one or more regex word characters (\w+).


You can see a brief intro video on ASPX Edit Helper at


Copy the three files AspxEditHelper.AddIn, AspxEditHelper.dll, and AspxEditHelperSnippets.xml to your Visual Studio add-ins folder:

%userprofile%\Documents\Visual Studio 2005\Addins
%userprofile%\Documents\Visual Studio 2008\Addins


Version 0.01 Binary
Version 0.01 Source Code

40 thoughts on “ASPX Edit Helper Add-In For Visual Studio

  1. Nice work! I’m curious why picked enter over tab for completing commands. Wouldn’t using tab be more consistent with the built-in VS code snippets?

  2. Awesome! I wanted something like this for a long time.

    Is it possible to make it trigger on “space”? For example: if type “

  3. @Dragos: Just create the Addins folder if it’s not there.

    @John S, @Peter: I wanted to trigger off space or tab but I didn’t find a way to do that with an add-in. The only event I could find was for LineChanged. This was my first VS add-in so if anyone knows a better way to hook changes events in the editor, please let me know!

  4. Very nice addin! I also had the problem with the ListItems, so I added the snippet below to AspxEditHelperSnippets.xml. Now I type “/li” and hit Enter for a listitem. I used the $id$ marker to position the cursor for editing.


  5. Trying again, hopefully with proper html formatting this time.

    <text><![CDATA[<asp:ListItem Text=”$id$” Value=””></asp:ListItem>]]></text>

  6. Thanks Derek.
    VS 2008 Addins folder is:
    %ALLUSERSPROFILE%Application DataMicrosoftMSEnvSharedAddIns

    Best regards

  7. What a great tool :)=

    Are you able to extend the addin to support adding eventhandler to server controls while in Visual Studio source view of as?c files?

    I really hate to switch to design view, hightlight the control to get its properties and to select the lightning bolt from the property window… finally there i can double click to create the eventhandler. that is far too complicated.

    Thanks, toebens

  8. Derek,

    Very cool! Plus I love the “Not Beta” emblem on your website.

    Mostafa’s comment about the location of the AddIns folder for VS2008 is correct – you might want to think about updating your instructions at the top of this page. Before I saw Mostafa’s comment I created an /AddIns folder under %userprofile%DocumentsVisual Studio 2008 and this triggered the GhostDoc configuration routine to run again next time I started VS2008.

    Also, I opened up the source code and modified the way the GenerateAspxElement function creates its return value. For what it’s worth, here’s the updated code block:

    If includeClosingTag = True Then
    retVal = String.Format(“”, tagName, controlID, tagName)
    retVal = String.Format(“”, tagName, controlID)
    End If

    With this mod, if I don’t want a closing tag I can type (for example): “” or “” and hit the Enter key and ASPX Edit Helper generates: “”. If I DO want a closing tag I can leave off the closing angle bracket and just type (for example): “”

  9. Hmmm… let me try that again with some HTML encoding.

    Here’s the modified code block in the GenerateAspxElement function:

    If includeClosingTag = True Then
    retVal = String.Format("<{0} runat=""server"" id=""{1}""></{2}>",
    tagName, controlID, tagName)
    retVal = String.Format("<{0} runat=""server"" id=""{1}""/>",
    tagName, controlID)
    End If

    With this mod, if I don’t want a closing tag I can type (for example): "<asp:Checkbox/>" or "<asp:Checkbox>" and
    hit the Enter key and ASPX Edit Helper generates: "<asp:CheckBox runat="server" id="asp_CheckBox6368"/>".
    If I DO want a closing tag I can leave off the closing angle bracket and just type (for example): "<asp:DropDownList" and hit Enter and ASPX Edit Helper generates: "<asp:DropDownList runat="server" id="asp_DropDownList1946"/></asp:DropDownList>"

  10. I keep getting the following error every time I try to get it to run in VS2008. I tried placing the files here to no avail (VS will not even recognize it – even though DevExpress dll is also there and it works):
    C:Documents and SettingsAll UsersApplication DataMicrosoftMSEnvSharedAddins

    I then tried creating the folder (Addins) as above (Visual Studio 2008Addins), then this happens (error).

    Microsoft Visual Studio
    The Add-in ‘ASPX Edit Helper’ failed to load or caused an exception.
    Would you like to remove this Add-in?
    If you choose yes, the file it was loaded from, ‘H:Visual Studio 2008AddinsAspxEditHelper.AddIn’, will be renamed.

    Error Message:
    Error number: 8013150a

    Any ideas why this could be?


  11. Ok, I think I see what is going on. My Documents folder is mapped to a remote drive. When I reset things to the local drive, it works. Is there any support for a mapped drive (company policy)?

  12. Mozes,
    I faced the same problem with another addin. Try copying the .addin file and the dll in the folder C:Documents and SettingsAll UsersApplication DataMicrosoftMSEnvSharedAddins, it worked for me. The Application Data folder is hidden.

  13. Thank you so much. This tool is wonderful.
    And thank you for the source code, Now I can add as many of these that I want.

  14. Hi, this looks very useful, thanks!
    I have a question for which I’ve not found an answer absolutely anywhere: at some point something in my VS2005 changed so that, whenever I double-click on an ASPX file in the Solution Explorer, it always opens the page in design view instead of HTML markup edit view. Like you, I much prefer working with the markup directly.
    Any idea how to change this setting??
    Sorry for the off-topic post but the people here sound like precisely the ones who’d be able to help me out 😉

  15. In answer to my own question: I found the solution and if you don’t mind I’ll document it here for those other lost souls to find via the big G…

    In VS2005 Solution Explorer, right-click on any .aspx file, choose “Open with…” In the dialog, tick “Source (Text) Editor”, tick “Set as default”, click “OK”.
    You’re in business – no more poxy design view.

  16. I’m having trouble getting the plugin to work in VS2008. I’ve added the add-in to C:Documents and SettingsAll UsersApplication DataMicrosoftMSEnvSharedAddins as suggested above. The add-in shows up in the Add-in Manager, but doesn’t seem to work. Any ideas?

  17. Thanks for this simple program. Using the line changed event is actually a good idea because it’s less taxing on the IDE.

    I made the following modification to the program:
    – Any character can now be use as a short cut for snippet.
    – For snippet that doesn’t have an ID, an $$ sign can now be use in CDATA to position the cursor in a more convenient place.

    Please contact me if you want the update source. I couldn’t find a contact form on your blog.

  18. I’m running the free express version of Visual Web Developer, and I can’t seem to get the ASPX edit helper to work. I’ve copied it to the Addins folder of visual studio 2008, but nothing happens. has anybody any thoughts on this please?

Leave a Reply

Your email address will not be published. Required fields are marked *