title: Enable Textbox on SelectedIndex change
body: <p>I am grabbing some records from a database depending on the id number of the page, the amount of records that will display will vary, anywhere to 1 record to 50. I need to take these records then choose which ones I will be modifying, deleting, or won't change at all. I would like it to look like this:</p>
  
  <p>Can't get image to show with stackoverflow image uploader so here: <a href="https://dl.dropboxusercontent.com/u/9446763/code/dropdownlist.jpg" rel="nofollow">https://dl.dropboxusercontent.com/u/9446763/code/dropdownlist.jpg</a></p>
  
  <p>I would like the text fields to be disabled if No Change or Remove is selected, and the fields enabled for revising if the option Modify is selected. </p>
  
  <p>Below is what I have so far, <strong>the part I am struggling on is the selectedindex change I do not know how to code it so that when Modify is selected in the dropdown box the appropriate textboxes become enabled.</strong></p>
  
  <p>ASPX Page</p>
  
  <pre><code>&lt;asp:PlaceHolder ID="PlaceHolder1" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
  </code></pre>
  
  <p>CS Page</p>
  
  <pre><code>private void createControls()
      {
          var id = Request.Params["ID"];
          System.Data.OleDb.OleDbConnection pcn;
          System.Data.OleDb.OleDbCommand pcm;
          System.Data.OleDb.OleDbDataReader prs;
          pcn = new System.Data.OleDb.OleDbConnection("");
          pcm = new System.Data.OleDb.OleDbCommand();
          pcn.Open();
          pcm.Connection = pcn;
          var tableSql = @"select * FROM grouplist where ptid = '" + id + "'";
          pcm.CommandText = tableSql;
          prs = pcm.ExecuteReader();
          var rowcount = 0;
          while (prs.Read())
          {
              rowcount++; 
  
              PlaceHolder1.Controls.Add(new Literal() { Text = "&lt;div class='row'&gt;&lt;div class='span3'&gt;" });
  
              TextBox tx = new TextBox();
              tx.ID = "txtData" + rowcount.ToString();
              tx.Text = prs["name"].ToString().Trim();
              tx.Width = 200;
              tx.CssClass = "span2";
              tx.Enabled = false;
              PlaceHolder1.Controls.Add(tx);
  
              PlaceHolder1.Controls.Add(new Literal() { Text = "&lt;/div&gt;&lt;div class='span2'&gt;" });
  
              TextBox txa = new TextBox();
              txa.ID = "amtData" + rowcount.ToString();
              txa.Text = prs["amt"].ToString();
              txa.CssClass = "span2";
              txa.Enabled = false;
              PlaceHolder1.Controls.Add(txa);
  
              PlaceHolder1.Controls.Add(new Literal() { Text = "&lt;/div&gt;&lt;div class='span3'&gt;" });
  
              DropDownList ddl = new DropDownList();
              ddl.Items.Add("No Change");
              ddl.Items.Add("Modify");
              ddl.Items.Add("Remove");
              ddl.Width = 200;
              ddl.CssClass = "span2";
              ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
              ddl.AutoPostBack = true;
              ddl.ID = "ddlData" + rowcount.ToString();
  
              PlaceHolder1.Controls.Add(ddl);
  
              PlaceHolder1.Controls.Add(new Literal() { Text = "&lt;/div&gt;&lt;/div&gt;" });
  
          }
          prs.Close();
      }
    void ddl_SelectedIndexChanged(object sender, EventArgs e)
      {
  
      }
  </code></pre>