2013-02-24 51 views
0

我有一個asp日曆控件,它包含在更新面板中。當點擊日期時,SelectionChanged()事件不會被觸發。這是代碼。如何調用aspx頁面包括服務器端代碼在jquery中使用jquery加載出Ajax方法?

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(); 
     } 
+0

主題幾乎不是一個完整的問題..請提供具體的d關於你想要完成什麼的細節。另外,請在不更改'<>'的情況下發布實際的代碼,並且用代碼塊 – charlietfl 2013-02-24 03:15:24

+0

包裝你確定你確實選擇了不同的選擇。這是一個選擇改變的事件,所以如果選擇沒有改變,則不會觸發任何事件。 – 2013-02-24 04:16:32

回答

0

我嘗試了上面的代碼,它的工作對我罰款(除非我刪除onvisiblemonthchanged = 「Calendar_VisibleMonthChanged」)

相關問題