views:

24

answers:

3

Hi I am following the NerdDinner MVC tutorial and wanted to copy a section of code from web page into Default.aspx page(some markup) . However these lines are copied in prefixed by line numbers - see below.This obviouslmy will not compile-how do I copy without these line numbers appearing.

23.        <%=Html.Encode(Model.Description) %>
24.    </p>      
25.    <p>
26.        <strong>Organizer:</strong>
27.        <%=Html.Encode(Model.HostedBy) %>
28.        (<%=Html.Encode(Model.ContactPhone) %>)
29.    </p>
30.     
31.    <%= Html.ActionLink("Edit Dinner", "Edit", new { id=Model.DinnerID })%> |
32.    <%= Html.ActionLink("Delete Dinner","Delete", new { id=Model.DinnerID})%>   
33.      
34.</asp:Content>
+1  A: 

Gosh, this would be so easy if you were using Visual Studio 2010 -- they added in a "vertical select" option (hold Alt+click+drag... or Alt+shift+cursor movements), which you could use to select only the line numbers and remove them with a single DEL keystroke.

But I think what you'll want to do in VS2008 is record a macro:

  1. Position your cursor before the beginning of a line number.

  2. Press Ctrl+Shift+R, delete the number using the DEL key, press arrow down to move to the beginning of the next line, then press Ctrl+Shift+R again.

  3. Now, every time you press Ctrl+Shift+P, you will play back the macro and delete another line. Repeat until you've removed all the line numbers.

Warren
vertical select date waaay back. VC IDE 6.0 had it if I recall correctly and all the vs.net versions
dkackman
Currently I remove the line using Regexp replace(^...) - works well.I was trying to see if there is an option to turn off the line numbering-obviously not . Alt Shift is working well too.
josephj1989
A: 

Use regexbuddy if you have it sitting around or get a free alternative.

ufotds
A: 

Actually Warren, that works fine in VS2008 (and a ton of other programs, including Notepad++).

I would have just added a comment to Warren's, but I don't have the rep yet, sorry.

Dugan