重置我有了兩個輸入元素的ASP.NET頁面:ASP.NET AJAX工具包 - CalendarExtender上回發
- 一個文本框是隻讀的。這個文本框是一個CalendarExtender
- 一個DropDownList與的AutoPostBack =真TargetControl
下面是代碼:
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2">Date:</td></tr>
<tr><td colspan="2">
<asp:TextBox ID="dateTextBox" runat="server" ReadOnly="true" />
<ajax:CalendarExtender ID="datePicker" runat="server" Format="MM/dd/yyyy" OnLoad="datePicker_Load" TargetControlID="dateTextBox" />
</td></tr>
<tr><td colspan="2">Select an Option:</td></tr>
<tr>
<td>Name: </td>
<td><asp:DropDownList ID="optionsDropDownList" runat="server" AutoPostBack="true"
OnLoad="optionsDropDownList_Load"
OnSelectedIndexChanged="optionsDropDownList_SelectedIndexChanged"
DataTextField="Name" DataValueField="ID" />
</td></tr>
<tr><td><asp:Button ID="saveButton" runat="server" Text="Save" OnClick="saveButton_Click" /></td></tr>
</table>
當DropDownList的回發,通過與日期選擇用戶選擇的日期重置爲當前日期。另外,如果我查看dateTextBox的Text屬性,它等於string.Empty。
如何保留用戶在回傳中選擇的日期?
Downvoting,因爲我相信@ taeda的答案是對這個問題的真正答案。 – 2013-01-28 22:54:00