我在asp.net 3.5應用程序中使用了Ajax日曆擴展控件(來自here)。獲取Ajax日曆擴展控件的選定日期
我的問題:如何從代碼隱藏文件中的Ajax日曆擴展控件中選擇日期?
說例如我從日曆中選擇01/01/2011,然後我需要在代碼後面的這個日期,因爲我需要檢查空值。
讓我知道任何查詢。
請指導。謝謝!
問題,代碼更新
<asp:Label ID="lblStartDate" runat="server" Text="<%$ Resources:Resource, lblStartDate %>" CssClass="boldlabelText"></asp:Label>
<asp:TextBox ID="txtStartDate" runat="server" ReadOnly="true" MaxLength="10"></asp:TextBox>
<asp:ImageButton runat="Server" ID="imgStartDate" ImageUrl="~/Images/Calender.png" AlternateText="Click to show calendar" />
<ajax:CalendarExtender ID="CalStartDate" runat="server" TargetControlID="txtStartDate" Format="yyyy-MM-dd" PopupButtonID="imgStartDate">
</ajax:CalendarExtender>
代碼隱藏(的.cs)
if (txtStartDate.Text.Equals(string.Empty)) // The text value always comes null
{
lblStartDateM.Visible = true;
txtStartDate.BackColor = Color.FromArgb(255, 255, 235);
blnIsValid = false;
}
非常感謝,它對我有很大幫助 –