[英]How to call aspx page including server side code in jquery load with out using jquery ajax method?
我有一个ASP日历控件,它包含在更新面板中。 当单击日期时,不会触发SelectionChanged()事件。 这是代码。
ASPX-
<asp:Calendar ID="Calendar" runat="server" BorderColor="green" NextPrevStyle-BackColor="green"
BorderStyle="Solid" Height="414px" NextPrevFormat="FullMonth" TitleStyle-BackColor="green"
DayStyle-Font-Underline="false" ShowGridLines="True" Width="567px" onvisiblemonthchanged="Calendar_VisibleMonthChanged"
SelectedDate="02/23/2013 15:33:22" VisibleDate="2013-02-23" onselectionchanged="Calendar_SelectionChanged">
<DayStyle Font-Underline="True" />
<NextPrevStyle BackColor="green" />
<SelectedDayStyle BackColor="green" Font-Bold="True" ForeColor="Black"
/>
<SelectorStyle Font-Bold="True" />
<TitleStyle BackColor="green" Font-Underline="False" />
<TodayDayStyle BackColor="green" Font-Bold="True" ForeColor="White" />
</asp:Calendar>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Calendar" EventName="SelectionChanged"
/>
</Triggers>
</asp:UpdatePanel>
服务器端代码-
protected void Calendar_SelectionChanged(object sender, EventArgs e)
{
Label1.Text = CalEdairy.SelectedDate.ToShortDateString();
}
我尝试了上面的代码,对我来说很好用。(除了我删除了onvisiblemonthchanged =“ Calendar_VisibleMonthChanged”)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.