title: How to get dynamically created DropDownList's ID and check if its value changed or not?
body: <p>I have implemented a view in which dynamic number of textboxes and DropDownList are generated, by the help of <a href="http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/" rel="nofollow">Steven Sanderson's blog</a>. All works fine. But I want that untill each dropdownlist has a value, form could not be submitted and also if there is no dropdownlist I mean all dynamic content deleted, then form MUST not be submit. </p>
  
  <p>Main View Code:</p>
  
  <pre><code>&lt;div id="Part2"&gt;
   &lt;h3&gt;&lt;u&gt;Services:&lt;/u&gt;&lt;/h3&gt;&lt;br /&gt;
   &lt;div id="EditorRows"&gt;
    &lt;%Html.RenderPartial("_InsertServices", Model);%&gt;
   &lt;/div&gt;
   &lt;div id="DontAppend"&gt;
    &lt;%= Html.ActionLink("+ Add Another Service", "Add", null, new { id = "addItem" }) %&gt;
    &lt;input type="button" id="btnEdit" value="Edit" hidden="hidden"/&gt;
    &lt;input type="button" id="btnDone" value="Done" /&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>PartialVew Code:</p>
  
  <pre><code>&lt;div class="EditorRow"&gt;
   &lt;% using (Html.BeginCollectionItem("services")){ %&gt;
   &lt;table id="table1"&gt;
    &lt;tr&gt;
     &lt;td&gt;NOS:&lt;/td&gt;
     &lt;td&gt;&lt;%:Html.DropDownListFor(model=&gt;model.Id,(SelectList)ViewData["crmServiceType"] as SelectList,"---")%&gt;&lt;/td&gt;
     &lt;td&gt;Comment:&lt;/td&gt;
     &lt;td&gt;&lt;%=Html.TextBoxFor(model =&gt; model.Comment, new { size = "20" })%&gt;&lt;/td&gt;
     &lt;td&gt;&lt;a href="#" class="deleteRow"&gt;delete&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
   &lt;/table&gt;
  &lt;% } %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>$("#addItem").click(function () {
    $.ajax({
    url: this.href,
    cache: false,
    success: function (html) { $("#EditorRows").append(html); }
    });
    return false;
  });
  $("a.deleteRow").live("click", function () {
    $(this).parents("div.EditorRow:first").remove();
    return false;
  });
  </code></pre>
  
  <p><a href="http://pastie.org/6409364" rel="nofollow">Here</a> is generated HTML Source.</p>