title: set selected value of a asp dropdown with jquery
body: <p>I am trying to set the dropdown value with jquery when modal popup is displayed. 
  I am trying with some static data but without any success.
  This is what I have:</p>
  
  <pre><code>$(document).on("click", ".open-EditSplitAgent", function () {
                var first = $(this).data('first');
                var last = $(this).data('last');
                var splitPC = $(this).data('splitpc');
                var id = $(this).data('id');
                $('#&lt;%=txtFirstEdit.ClientID%&gt;').val(first);
                $('#&lt;%=txtLastEdit.ClientID%&gt;').val(last);
                $('#&lt;%=hfLifeID.ClientID%&gt;').val(id);              
                $("#ddlAgentPercEdit").val('0.50');             
                $('#editSplitAgent').modal('show');
            });
  </code></pre>
  
  <p>The dropdown has this values:</p>
  
  <pre><code>  &lt;asp:DropDownList ID="ddlAgentPercEdit" runat="server"&gt;
                                     &lt;asp:ListItem Value=""&gt;Select Percentage&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.50"&gt;0.5&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.75"&gt;0.75&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.9"&gt;0.01&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.7"&gt;0.7&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.1"&gt;0.1&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.8"&gt;0.8&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.6"&gt;0.6&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.9"&gt;0.9&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.05"&gt;0.05&lt;/asp:ListItem&gt;
                                   &lt;asp:ListItem Value="0.95"&gt;0.95&lt;/asp:ListItem&gt;
                               &lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>I have textbox and hidden field which have the correct value when the modal popup is displayed.
  As you can see in the jquery event I am trying static data just so I can see its working ok with static data, but originally I'll need to assign the splitPC var value to the dropdown value.
  Thanks in advance for your advices,
  Laziale</p>
  
  <p>EDIT: 
  rendered code for the modal popup:</p>
  
  <pre><code>        &lt;div class="modal hide fade" tabindex="-1" role="dialog" id="editSplitAgent"&gt;
   &lt;div class="modal-header"&gt;
      &lt;button class="close" data-dismiss="modal"&gt;×&lt;/button&gt;
      &lt;h3&gt;Edit Split Agent&lt;/h3&gt;   
    &lt;/div&gt;
      &lt;div class="modal-body"&gt;       
          &lt;div class="content"&gt;
  
                &lt;div class="form-row row-fluid"&gt;
                        &lt;div class="span12"&gt;
                            &lt;div class="row-fluid"&gt;
                                 &lt;label class="form-label span4" for="tooltip"&gt;First Name&lt;/label&gt;
                                 &lt;input name="ctl00$ContentPlaceHolder1$txtFirstEdit" type="text" id="ctl00_ContentPlaceHolder1_txtFirstEdit" class="span8 tip" /&gt;       
                                   &lt;span id="ctl00_ContentPlaceHolder1_RequiredFieldValidator4" style="color:Red;display:none;"&gt;&lt;/span&gt;
              &lt;input type="hidden" name="ctl00$ContentPlaceHolder1$ValidatorCalloutExtender5_ClientState" id="ctl00_ContentPlaceHolder1_ValidatorCalloutExtender5_ClientState" /&gt;                                                        
                             &lt;/div&gt;
                        &lt;/div&gt; 
                  &lt;/div&gt;
                   &lt;div class="form-row row-fluid"&gt;
                        &lt;div class="span12"&gt;
                            &lt;div class="row-fluid"&gt;
                                 &lt;label class="form-label span4" for="tooltip"&gt;Last Name&lt;/label&gt;
                                 &lt;input name="ctl00$ContentPlaceHolder1$txtLastEdit" type="text" id="ctl00_ContentPlaceHolder1_txtLastEdit" class="span8 tip" /&gt;  
                                     &lt;span id="ctl00_ContentPlaceHolder1_RequiredFieldValidator5" style="color:Red;display:none;"&gt;&lt;/span&gt;
              &lt;input type="hidden" name="ctl00$ContentPlaceHolder1$ValidatorCalloutExtender6_ClientState" id="ctl00_ContentPlaceHolder1_ValidatorCalloutExtender6_ClientState" /&gt;                                                         
                             &lt;/div&gt;
                        &lt;/div&gt; 
                  &lt;/div&gt;
               &lt;div class="form-row row-fluid"&gt;
                        &lt;div class="span12"&gt;
                            &lt;div class="row-fluid"&gt;
                                 &lt;label class="form-label span4" for="tooltip"&gt;Agent Percentage&lt;/label&gt;
                                   &lt;div class="span8 controls"&gt;
                               &lt;select name="ctl00$ContentPlaceHolder1$ddlAgentPercEdit" id="ctl00_ContentPlaceHolder1_ddlAgentPercEdit"&gt;
      &lt;option value=""&gt;Select Percentage&lt;/option&gt;
      &lt;option value="0.50"&gt;0.5&lt;/option&gt;
      &lt;option value="0.75"&gt;0.75&lt;/option&gt;
      &lt;option value="0.9"&gt;0.01&lt;/option&gt;
      &lt;option value="0.7"&gt;0.7&lt;/option&gt;
      &lt;option value="0.1"&gt;0.1&lt;/option&gt;
      &lt;option value="0.8"&gt;0.8&lt;/option&gt;
      &lt;option value="0.6"&gt;0.6&lt;/option&gt;
      &lt;option value="0.9"&gt;0.9&lt;/option&gt;
      &lt;option value="0.05"&gt;0.05&lt;/option&gt;
      &lt;option value="0.95"&gt;0.95&lt;/option&gt;
  
  &lt;/select&gt;
                                 &lt;/div&gt;
                             &lt;/div&gt;
                        &lt;/div&gt; 
                  &lt;/div&gt;
              &lt;input type="hidden" name="ctl00$ContentPlaceHolder1$hfLifeID" id="ctl00_ContentPlaceHolder1_hfLifeID" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>