掃二維碼與項目經(jīng)理溝通
我們在微信上24小時期待你的聲音
解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流
參照用JavaScript編寫的日期選擇,將其中的JavaScript部分寫入控件中就可以了。C#日期時間控件代碼不復雜,拿出來大家共享以下。大家?guī)兔φ艺褺ug,提提改進意見。

成都創(chuàng)新互聯(lián)公司專注于企業(yè)全網(wǎng)整合營銷推廣、網(wǎng)站重做改版、普洱網(wǎng)站定制設(shè)計、自適應品牌網(wǎng)站建設(shè)、html5、商城網(wǎng)站制作、集團公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為普洱等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
實現(xiàn)效果如下:
Bug:控件放到frame 的頁面里面使用得時候就會出錯:“parent.event 為空或不是對象”
將InputCalendar.cs中output.WriteLine("parent.event.cancelBubble=true;");一句去掉即可。
這一句的意義是:設(shè)置或獲取當前事件是否要在事件句柄中向上冒泡。當前應用中好像沒有用,所以去掉也不要緊。
如何增加Autopostpack功能:
- if (autopostback==true )
- {
- output.WriteLine ("javascript:"+Page.GetPostBackEventReference(this)+";");
- }
- //添加了一個AUTOPOSTBACK功能。
在頭部加上如下代碼,即可實現(xiàn)選擇Autopostpack功能了。
- private bool autopostback=true;
- [Bindable(true),
- Category("Appearance"),
- DefaultValue(true)]
- public bool AutoPostBack
- {
- get
- {
- return autopostback;
- }
- set
- {
- autopostback=value;
- }
- }
解決在用戶C#日期時間控件控件中取值問題:
將原來的C#日期時間控件:
- output.AddAttribute(HtmlTextWriterAttribute.Id,this.ID);
- output.AddAttribute(HtmlTextWriterAttribute.Name,this.ID);
改為:
- output.AddAttribute(HtmlTextWriterAttribute.Id,this.UniqueID);
- output.AddAttribute(HtmlTextWriterAttribute.Name,this.UniqueID);
將原來的C#日期時間控件:
- output.AddAttribute(HtmlTextWriterAttribute.Id,this.ID); output.AddAttribute(HtmlTextWriterAttribute.Name,this.ID); 改為: output.AddAttribute(HtmlTextWriterAttribute.Id,this.UniqueID); output.AddAttribute(HtmlTextWriterAttribute.Name,this.UniqueID);

我們在微信上24小時期待你的聲音
解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流