我有一个ASP.NET页面有两个输入元素:
> ReadOnly的TextBox.此TextBox是CalendarExtender的TargetControl
>具有AutopostBack = True的DropDownList
这是代码:
<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发回时,用户使用datePicker选择的日期将重置为当前日期.另外,如果我查看dateTextBox的Text属性,它等于string.Empty.
如何保留用户在PostBack上选择的日期?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。