大佬教程收集整理的这篇文章主要介绍了ASP.NET AJAX工具包 – CalendarExtender在Postback上重置,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
> 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上选择的日期?
编辑:好的,我有一个答案.根据to this forum question,只读控件没有发回到服务器.所以,当你做一个回发,你将失去一个只读控件的价值.您将不需要只读控件.
以上是大佬教程为你收集整理的ASP.NET AJAX工具包 – CalendarExtender在Postback上重置全部内容,希望文章能够帮你解决ASP.NET AJAX工具包 – CalendarExtender在Postback上重置所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。