程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> ASP.NET >> ASP.NET基礎 >> asp.net中日歷函數Calendar的使用方法

asp.net中日歷函數Calendar的使用方法

編輯:ASP.NET基礎
今天介紹的是微軟提供的ajax calendar控件。這個控件使用了ajax的效果,並通過前台js和style設置事件和效果。功能豐富、樣式自有,實為網站設計、mis開發之必備控件。

按照慣例,現在該貼代碼了:

<asp教程:textbox runat="server" id="txtcalendar" width="150" />
<ajaxtoolkit:calendarextender runat="server" targetcontrolid="txtcalendar" css教程class="mycalendar" format="yyyy-mm-dd" />

由於設置了樣式,所以這裡也把代碼貼出來吧,只是寫一個簡單的樣式:
復制代碼 代碼如下:
.mycalendar .ajax__calendar_container{
border: 1px solid #646464;
background-color: maroon;
color: red;
}

這樣運行的時候,你會發現,丫的居然是英語的,沒有咱們漢語,這讓我們情何以堪呀!怎麼辦呢?當然有解決辦法,並且很輕松的實現。不賣關子了,其實只需要設置enablescriptglobalization 和 enablescriptlocalization 為true就可以了。

接下來的說說屬性吧,targetcontrolid不說了,format就是設置顯示的樣式,和c#中日期格式format是一樣的。popupbuttonid是點擊的彈出的按鈕控件id。

樣式有很多:
.ajax__calendar_container
.ajax__calendar_header
.ajax__calendar_prev
.ajax__calendar_title

web 控件標准屬性
accesskey, attributes, backcolor, bordercolor, borderstyle, borderwidth,
cssclass, enabled, font, enabletheming, forecolor, height, isenabled,
skinid, style, tabindex, tooltip, width如需完整描述,請訪問 web 控件標准屬性。
控件標www.3ppt.com准屬性
apprelativetemplatesourcedirectory, bindingcontainer, clientid, controls,
enabletheming, enableviewstate, id, namingcontainer, page, parent, site,
templatecontrol, templatesourcedirectory, uniqueid, visible如需完整描述,請訪問控件標准屬性。

屬性

屬性 描述 .net caption 日歷的標題。 2.0 captionalign 日歷標題文本的對齊方式。 2.0 cellpadding 單元格邊框與內容之間的空白,以像素計。 1.0 cellspacing 單元格之間的空白,以像素計。 1.0 dayheaderstyle 顯示一周中某天的名稱的樣式。 1.0 daynameformat 顯示周中各天的名稱格式。 1.0 daystyle 顯示日期的樣式。 1.0 firstdayofweek 哪天是周的第一天。 1.0 nextmonthtext 顯示下一月鏈接的文本。 1.0 nextprevformat 下一月和上一月鏈接的格式。 1.0 nextprevstyle 顯示下一月和上一月鏈接的樣式。 1.0 othermonthdaystyle 顯示不在當前月中的日期的樣式。 1.0 prevmonthtext 顯示上一月鏈接的文本。 1.0 runat 規定該控件是服務器控件。必須設置為 "server"。 1.0 selecteddate 選定的日期。 1.0 selecteddates 選定的日期。 1.0 selecteddaystyle 選定日期的樣式。 1.0 selectionmode 允許用戶如何選擇日期。 1.0 selectmonthtext 顯示為月份選擇鏈接的文本。 1.0 selectorstyle 月份和周的選擇鏈接的樣式。 1.0 selectweektext 顯示為周的選擇鏈接的文本。 1.0 showdayheader 布爾值,該值指示是否顯示一周中各天的標頭。 1.0 showgridlines 布爾值,規定是否顯示日期之間的網格線。 1.0 shownextprevmonth 布爾值,規定是否顯示下一月和上一月鏈接。 1.0 showtitle 布爾值,規定是否現實日期的標題。 1.0 titleformat 日期標題的格式。 1.0 titlestyle 日期標題的樣式。 1.0 todaydaystyle 當天的日期的樣式。 1.0 todaysdate 獲取或設置今天的日期的值。 1.0 useaccessibleheader 規定是否使用 <th> 來代替 <td> 元素用於日的頭部。 2.0 visibledate 獲取或設置指定要在 calendar 控件上顯示的月份的日期。 1.0 weekenddaystyle 周末的樣式。 1.0 ondayrender 當每一天的單元格被創建時,所執行的函數的名稱。   onselectionchanged 當用戶選擇天、周或月時 ,所執行的函數的名稱。   onvisiblemonthchanged 當用戶導航到不同的月時,所執行的函數的名稱。
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved