title: Set selected value of dropdown list in Gridview.RowEditing
body: <p>I am doing insert/update and delete in gridview. For that I am using ItemTemplate which contains labels to show the values. But when the gridview is in edit mode, the dropdown lists comes in place of that labels. I want to set the selected values of drop down lists to the values of labels. My drop down lists dont have datasource. I am binding dropdown list from 0 to 99. Below is the code for my edit method.</p>
  
  <pre><code> protected void grdUsedCatheters_RowEditing(object sender, GridViewEditEventArgs e)
   {
      try
      {
          grdUsedCatheters.EditIndex = e.NewEditIndex;
          BindCatheterGrid();
          DropDownList ddlFrom = (DropDownList)grdUsedCatheters.Rows[e.NewEditIndex].FindControl("ddFrom");
          DropDownList ddlTo = (DropDownList)grdUsedCatheters.Rows[e.NewEditIndex].FindControl("ddTo");
          BindDropDowns(ddlFrom);
          BindDropDowns(ddlTo);
  
      }
      catch (Exception ex)
      {
          if (ex.HelpLink == null)
              lblMessage.Text = ex.Message;
          else
              lblMessage.Text = ex.HelpLink;
          lblMessage.CssClass = "ERROR";
      }
  
  private void BindDropDowns(DropDownList ddl)
   {
      for (int i = 0; i &lt;= 99; i++)
          ddl.Items.Add(i.ToString());
   }
  </code></pre>
  
  <p>below is the part of markup of my gridview</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Cine Run"&gt;
     &lt;ItemTemplate&gt;
          From:&amp;nbsp;&lt;asp:Label ID="lblFrom" runat="server" &gt;&lt;%# Eval("CineRunFrom")%&gt;&lt;/asp:Label&gt;
          To:&amp;nbsp;&lt;asp:Label ID="lblTo" runat="server"&gt;&lt;%# Eval("CineRunTo")%&gt;&lt;/asp:Label&gt;
     &lt;/ItemTemplate&gt;
     &lt;EditItemTemplate&gt;
         From:&amp;nbsp;&lt;asp:DropDownList ID="ddFrom" runat="server" Width="50px"&gt;
       &lt;/asp:DropDownList&gt;
         To:&amp;nbsp;&lt;asp:DropDownList ID="ddTo" runat="server" Width="50px"&gt;
       &lt;/asp:DropDownList&gt;
     &lt;/EditItemTemplate&gt;
    &lt;FooterTemplate&gt;
         From:&amp;nbsp;&lt;asp:DropDownList ID="ddFromF" runat="server" Width="50px"&gt;              &lt;/asp:DropDownList&gt;
         To:&amp;nbsp;&lt;asp:DropDownList ID="ddToF" runat="server" Width="50px"&gt;                                        &lt;/asp:DropDownList&gt;
    &lt;/FooterTemplate&gt;
   &lt;/asp:TemplateField&gt;
  
  } 
  </code></pre>