ASP日历是每次更改(日,月......)的刷新页面。我该如何阻止?
<asp:Calendar AutoPostback = "false" EnableViewState="true" SelectedDate="<%# DateTime.Now.Date %>" ID="Calendar1" runat="server" BackColor="White" BorderColor="White" BorderWidth="1px" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="190px" NextPrevFormat="FullMonth" Width="250px">
<DayHeaderStyle Font-Bold="True" Font-Size="8pt"></DayHeaderStyle><NextPrevStyle VerticalAlign="Bottom" Font-Bold="True" Font-Size="8pt" ForeColor="#333333"></NextPrevStyle>
<OtherMonthDayStyle ForeColor="#999999"></OtherMonthDayStyle>
<SelectedDayStyle BackColor="#333399" ForeColor="White"></SelectedDayStyle
<TitleStyle BackColor="White" BorderColor="Black" BorderWidth="0px" Font-Bold="True" Font-Size="12pt" ForeColor="#333399"></TitleStyle>
<TodayDayStyle BackColor="#CCCCCC"></TodayDayStyle>
</asp:Calendar>
答案 0 :(得分:0)
从您的aspx页面中删除
SelectedDate="<%# DateTime.Now.Date %>"
...并将其放入您的Page_Load()
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
Calendar1.SelectedDate = DateTime.Now.Date;
}