title: Get selected date of ajax calendar extender control
body: <p>I have used Ajax Calendar extender control (from <a href="http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/calendar/calendar.aspx" rel="nofollow">here</a>) in my asp.net 3.5 application.</p>
  
  <p>My Question: How can i get the selected date from the Ajax calendar extender control in code behind file?</p>
  
  <p>Say for example i am selecting 01/01/2011 from calendar, then i need this date in code behind, as i need to check for null values.</p>
  
  <p>let me know for any query.</p>
  
  <p>Please guide. Thanks!</p>
  
  <p><strong>Question updated with code</strong></p>
  
  <pre><code> &amp;nbsp; &lt;asp:Label ID="lblStartDate" runat="server" Text="&lt;%$ Resources:Resource, lblStartDate %&gt;" CssClass="boldlabelText"&gt;&lt;/asp:Label&gt;
                                          &amp;nbsp;&lt;asp:TextBox ID="txtStartDate" runat="server" ReadOnly="true" MaxLength="10"&gt;&lt;/asp:TextBox&gt;
                                          &lt;asp:ImageButton runat="Server" ID="imgStartDate" ImageUrl="~/Images/Calender.png" AlternateText="Click to show calendar" /&gt;
                                          &lt;ajax:CalendarExtender ID="CalStartDate" runat="server" TargetControlID="txtStartDate" Format="yyyy-MM-dd" PopupButtonID="imgStartDate"&gt;
                                          &lt;/ajax:CalendarExtender&gt;
  </code></pre>
  
  <p>Code-Behind (.cs)</p>
  
  <pre><code>if (txtStartDate.Text.Equals(string.Empty))  // The text value always comes null
          {
              lblStartDateM.Visible = true; 
              txtStartDate.BackColor = Color.FromArgb(255, 255, 235);
              blnIsValid = false;
          }
  </code></pre>