All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
增加网站流量方法之ASP.NET弹出窗口技术_.net资料_编程技术
ASP.NET开发经验(3):使用,GUID,值来作为数据库行标识_[Asp.Net教程]
XML入门教程:XML是如何被利用的?_[XML教程]
PHP实例:实例分析学习动态网页制作技术PHP开发投票系统_[PHP教程]
Asp.Net,Ajax,学习笔记3,UpdatePanel的使用(上)_[Asp.Net教程]
在SQL Server中使用NewID()产生随机集_[SQL Server教程]
在ASP.NET中利用VWD操作数据库简介_.net资料_编程技术
温故知新ASP.NET,2.0(C#)(8),-,DataSourceControl(数据源控件)_[Asp.Net教程]
ASP.NET上传大于4M的文件的相关设置_[Asp.Net教程]
.net(C#)开发小技巧漫谈之一_[Asp.Net教程]
Reading number is top 10 pictures
各种囧况!玩游戏最不喜欢出现的十件事(点评)
西游四格漫画(三)
Summer is most suitable for young people to travel in China3
30 beautiful school beauty1
Original author said, this is the Hengyang people
China's zhejiang university to create the world's most light material
接财神,大吉大利,财源滚滚来
再发两张抽象画
世界各国15岁的MM有什么不同
The money of more than 100 countries and regions13
Download software ranking
SP4 for SQL2000
Tram sex maniac 2 (H) rar bag5
Unix video tutorial19
在线棋牌游戏3.05版
Desire a peach blossom
JSP+Ajax Web development typical examples
SP3 for SQL2000
株洲本地在线棋牌游戏
电车之狼R
Boxer Classic video1
归海一刀 published in(发表于) 2014/1/30 1:22:20 Edit(编辑)
ASP.NET日历控件二次开发和使用_[Asp.Net教程]

ASP.NET日历控件二次开发和使用_[Asp.Net教程]

ASP.NET日历控件二次开发和使用_[Asp.Net教程]
  asp.net自带的日历控件功能强大,在很多项目开发中用到,现在为了使它更美观实用,我们对它进行二次开发。
  新建一个用户控件,把calender控件拉进来。第一步是外观设置,这个根据你的需要,只需对它的相关属性做一些调整即可。下图是我调整后的网页界面

属性设置如下:

<asp:calendar id="Calendar1" CellPadding="2" Width="160px" TitleStyle-BackColor="#000000"
  BorderColor="#aaaaaa"
  DayHeaderStyle-BackColor="#5e715e"
  OtherMonthDayStyle-ForeColor="#cccccc"
  DayNameFormat="Full"
  runat="server"
  TitleStyle-ForeColor="#ffffff"
  NextPrevStyle-ForeColor="#ffffff"
  CellSpacing="1"
  WeekendDayStyle-BackColor="#eeeeee"
  DayHeaderStyle-ForeColor="#ffffff"
  SelectionMode="None"
  TodayDayStyle-BorderColor="#5e715e"
  TodayDayStyle-BorderWidth="1"
  TodayDayStyle-Font-Bold="true"
  TodayDayStyle-ForeColor="#5e715e"
  >

  第二步是对内部功能的调整,这个工作主要集中在以下两个事件的处理上。
  PreRender:当服务器控件将要呈现给其包含的Page对象时发生。
  DayRender:当为Calendar控件在控件层次结构中创建每一天时发生。
  先定义三个整型变量和整型数组
  private int[] arrCurrentDays,arrPreDays,arrNextDays; //三个变量分别是当前月,前一月,和下一个月
  private int intCurrentMonth,intPreMonth,intNextMonth; //三个整型数组存放相对月份写日期
  protected System.Web.UI.WebControls.Calendar Calendar1; //这个就是我们的日历控件了
  2. 下面我将分别给出这两个事件的源码,并在下面解释它实现的功能,如果你看不明白,可以先看下面的说明
  PreRender


private void Calendar1_PreRender(object sender, System.EventArgs e)
  {
  Thread threadCurrent = Thread.CurrentThread;
  CultureInfo ciNew = (CultureInfo)threadCurrent.CurrentCulture.Clone();
  ciNew.DateTimeFormat.DayNames = new string[]{"日","一","二","三","四","五","六"};
  ciNew.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday;
  threadCurrent.CurrentCulture = ciNew;
  }

  以上代码改变了星期名称的显示。你只需改变字符数组的值就能改名称显示。
  DayRender


private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
  {
  //该控件在创建每一天时发生。
  CalendarDay d = ((DayRenderEventArgs)e).Day;
  TableCell c = ((DayRenderEventArgs)e).Cell;
  }


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.