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

來源:互聯網
上載者:User
今天介紹的是微軟提供的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 當使用者導航到不同的月時,所執行的函數的名稱。


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.