title: Change text in Label on selecting new item from dropdownlist
body: <p>I want to change the label's text as soon as I select the item in dropdownlist.
  Here's my code</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      tbusrcompdate.Attributes.Add("readonly", "readonly");
      if (!IsPostBack)
      {
          //populating ddlTaskId
          string query = "select * from Compliance_Tracker.dbo.tasklistManager where STATUS='1';";
          string columnname = "TASK ID";
          string datavaluefield = "TASK ID";
          obj7.PopulateCombo(ddlTaskID, query, columnname, datavaluefield);
          //default values in labels
          string query1 = "select top 1 [DESC] from Compliance_Tracker.dbo.tasklistManager where STATUS = '1';";
          lblDescOutput.Text = obj7.ExecuteScalar(query1).ToString();
          string query2 = "select top 1 FREQUENCY from Compliance_Tracker.dbo.tasklistManager where STATUS = '1';";
          lblFrequencyOutput.Text = obj7.ExecuteScalar(query2).ToString();
  
      }
  }
  protected void UploadButton_Click(object sender, EventArgs e)
  {
      StatusLabel.Text = "Upload status:";
      if (FileUploadControl.HasFile)
      {
          try
          {
  
              string filename = Path.GetFileName(FileUploadControl.FileName);
              FileUploadControl.SaveAs(Server.MapPath("~/") + filename);
              //string test = Server.MapPath("~/").ToString() + filename.ToString();
              StatusLabel.Text = "Upload status: File uploaded!";
  
          }
          catch (Exception ex)
          {
              StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
          }
      }
  }
   protected void ddlTaskID_TextChanged(object sender, EventArgs e)
  {
  
  }
  protected void ddlTaskID_SelectedIndexChanged(object sender, EventArgs e)
  {
      string selectedtext = ddlTaskID.SelectedItem.Text;
      string query = "select [DESC] from Compliance_Tracker.dbo.tasklistManager where Compliance_Tracker.dbo.tasklistManager.[TASK ID] ='" + selectedtext + "';";
      lblDescOutput.Text = obj7.ExecuteScalar(query).ToString();
  }
  </code></pre>
  
  <p>As in the code above I have tried to do it using the SelectIndexChanged and TextChanged events . But, I finally get it on pressing the upload button but I want the label's text to be changed as soon as the value of dropdown list is selected.
  Here' my html</p>
  
  <pre><code>&lt;asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder3" Runat="Server"&gt;
  &lt;form id="Form1" runat="server" style="border-style: none; border-width: inherit; border-color: #008000; background-color:#33CC33; height:588px; width:669px; background-image: url('new.jpg'); background-repeat: no-repeat;" method="post" enctype="multipart/form-data"&gt;
      &lt;h1 style="height: 34px"&gt;
          TRANSACTION MANAGER TABLE
      &lt;/h1&gt;
      &lt;asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"&gt;&lt;/asp:ToolkitScriptManager&gt;
       &lt;table id="table1" style="border-style: none; height:188px; width:549px; margin-left:30px; border-collapse: collapse; margin-top: 0px;"&gt;
          &lt;tr&gt;
              &lt;td style="width: 137px; height:30px;"&gt;&lt;asp:Label ID="lblTaskID" runat="server" Text="TASK ID" Width="70px"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;td style="height:30px"&gt;&lt;asp:DropDownList ID="ddlTaskID" runat="server" Height="20px" style="margin-left: 50px" Width="126px" OnTextChanged="ddlTaskID_TextChanged" OnSelectedIndexChanged="ddlTaskID_SelectedIndexChanged" &gt;&lt;/asp:DropDownList&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="width:137px; height:30px;"&gt;&lt;asp:Label ID="lblDesc" runat="server" Text="DESC" Width="70px"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;td style ="height:30px"&gt;&lt;asp:Label ID="lblDescOutput" runat="server" style="margin-left:50px" Width="126px" Height="20px"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="width: 137px; height:30px;"&gt;&lt;asp:Label ID="lblFrequency" runat="server" Text="FREQUENCY" Width="132px"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;td style="height:30px"&gt;&lt;asp:Label ID="lblFrequencyOutput" runat="server" style="margin-left:50px" Width="126px" Height="20px"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="width: 137px; height:30px;"&gt;&lt;asp:Label ID="lblDocpath" runat="server" Text="DOC PATH" Width="107px"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;td style="height:30px"&gt;
                 &lt;asp:FileUpload id="FileUploadControl" runat="server" /&gt;
                 &lt;asp:Button runat="server" id="UploadButton" text="Upload" onclick="UploadButton_Click" /&gt;
                 &lt;br /&gt;&lt;br /&gt;
                 &lt;asp:Label runat="server" id="StatusLabel" text="Upload status: " /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="width: 137px; height:30px;"&gt;&lt;asp:Label ID="lblusrcompdate" runat="server" Text="USER COMPLETE DATE" Width="147px"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;td style="height:30px"&gt;&lt;asp:TextBox ID="tbusrcompdate" runat="server"&gt;&lt;/asp:TextBox&gt;
  
                  &lt;asp:ImageButton ID ="imgbtncalender" runat="server" ImageUrl="~/home-calendar-button.jpg" Height="17px" style="margin-left: 16px" Width="16px" /&gt;
                  &lt;asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="tbusrcompdate" Format="dd/MM/yyyy" PopupButtonID="imgbtncalender"&gt;&lt;/asp:CalendarExtender&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;&lt;br /&gt;
      &lt;asp:Button ID="btnAdd" runat="server" Text="ADD" Height="27px" Width="80px" style="margin-left:235px"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>
  The values in the labels are to be fetched from the tasklistManager table using the TASK ID drop down list the code for that as shown above is</p>
  
  <pre><code> string query1 = "select top 1 [DESC] from Compliance_Tracker.dbo.tasklistManager where STATUS = '1';";
          lblDescOutput.Text = obj7.ExecuteScalar(query1).ToString();
          string query2 = "select top 1 FREQUENCY from Compliance_Tracker.dbo.tasklistManager where STATUS = '1';";
          lblFrequencyOutput.Text = obj7.ExecuteScalar(query2).ToString();
  </code></pre>