當前位置:首頁 » 網頁前端 » web點擊任意地方觸發事件
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

web點擊任意地方觸發事件

發布時間: 2023-03-11 10:16:38

⑴ web控制項calender怎麼弄可以點擊每日觸發事件,為了添加日程安排,還有怎麼讓日程顯示

調用 calender 控制項的 SelectionChange方法和 OnDayRender方法

protected void myCalendar_SelectionChanged(object sender, EventArgs e)
{
this.lbText.Text = "您選擇的日期是:" + this.myCalendar.SelectedDate.Month.ToString() + "月"
+ this.myCalendar.SelectedDate.Day.ToString() + "號";
this.lbText.ForeColor = Color.Blue;
}

void DayRender(Object source, DayRenderEventArgs e)
{

// Change the background color of the days in the month
// to yellow.
if (!e.Day.IsOtherMonth && !e.Day.IsWeekend)
e.Cell.BackColor=System.Drawing.Color.Yellow;

// Add custom text to cell in the Calendar control.
if (e.Day.Date.Day == 18)
e.Cell.Controls.Add(new LiteralControl("<br />Holiday"));

}