How to do region collapse for JS in Visual Studio 2012/2013

TheMuyu picture TheMuyu · Nov 12, 2014 · Viewed 32k times · Source

Region code collapse for JS in Visual Studio 2012 and 2013 ?

#region AutoComplete JS
$("#<%=txtBirim.ClientID %>").autocomplete({
   source: function (request, response) {
     $.ajax({
       url: '<%=ResolveUrl("~/Classlar/TextboxOtomatik.asmx/BirimGetir") %>',
       data: "{ 'prefix': '" + request.term + "'}",
       dataType: "json",
       type: "POST",
       contentType: "application/json; charset=utf-8",
       success: function (data) {
       response($.map(data.d, function (item) {
         return {
         label: item.split('-')[0],
         val: item.split('-')[1]
       }
      }))
     },
    Code....
#endregion

Is there anyway to do something like this ?

Answer

Pandiyan Cool picture Pandiyan Cool · Nov 12, 2014

Install web essentials

Use the same name in end region

//#region AutoComplete JS
$("#<%=txtBirim.ClientID %>").autocomplete({
      source: function(request, response) {
          $.ajax({
                url: '<%=ResolveUrl("~/Classlar/TextboxOtomatik.asmx/BirimGetir") %>',
                data: "{ 'prefix': '" + request.term + "'}",
                dataType: "json",
                type: "POST",
                contentType: "application/json; charset=utf-8",
                success: function(data) {
                  response($.map(data.d, function(item) {
                    return {
                      label: item.split('-')[0],
                      val: item.split('-')[1]
                    }
                  }))
                },
                Code....
//#endregion AutoComplete JS