Thursday, April 21, 2011

Visual Studio nifty shortcut

Commenting (keyboard shortcut: Ctrl+KC) is more cool when you are editing a page. When the cursor is inside of tags, it will comment the enclosing tag on both ends(i.e. beginning tag and closing tag) even you didn't highlight the beginning tag and closing tag.

<div class="editor-field">
 <table>
 <tr>                    
  <td>@Html.AjaxComboBoxFor(model => model.CategoryId,
   "/Category/Lookup",
   "/Category/Caption",
   new { style = "width: 300px " },
   new { sub_info = true } )
  </td>
  <td>@Html.ValidationMessageFor(model => model.CategoryId)</td>
 </tr>
 </table>
</div>



If you position your cursor after of <table> then you press Ctrl+KC, Visual Studio will put comment around your table tags


<div class="editor-field">
 @*<table>
 <tr>                    
  <td>@Html.AjaxComboBoxFor(model => model.CategoryId,
   "/Category/Lookup",
   "/Category/Caption",
   new { style = "width: 300px " },
   new { sub_info = true } )
  </td>
  <td>@Html.ValidationMessageFor(model => model.CategoryId)</td>
 </tr>
 </table>*@
</div>

No comments:

Post a Comment