title: MVC3 Cascading Dropdown with JQuery to Populate Sublist on Edit
body: <p>I have a working cascading dropdown in create view with this javascript</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
        $(document).ready(function () {
        $("#GaCatId").change(function () {
          var id = $(this).val();
          $.getJSON("/Gallery/GetSubCategories/", { id: id },
          function (data) {
              var select = $("#GaSCatId");
              select.empty();
              select.append($('&lt;option/&gt;', {
                  value: 0,
                  text: "Select a Sub Category"
              }));
              $.each(data, function (index, data) {
  
                  select.append($('&lt;option/&gt;', {
                      value: data.Value,
                      text: data.Text
                  }));
              });
          });
      });
  });    
  </code></pre>
  
  <p></p>
  
  <p>I want to edit this  so that on Edit  razor View it will populate the sublist based on the default ID record in database. In effect I am looking making the code check if there is an ID</p>