直接上代码,不多说别的了

  1. <asp:ScriptManager ID="ScriptManager1" runat="server">
  2. </asp:ScriptManager>
  3. <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  4. <ContentTemplate>
  5. <asp:DropDownList ID="DropDownListYear" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListYear_SelectedIndexChanged">
  6. <asp:ListItem Value=""></asp:ListItem>
  7. <asp:ListItem Value=""></asp:ListItem>
  8. <asp:ListItem Value=""></asp:ListItem>
  9. <asp:ListItem Value=""></asp:ListItem>
  10. <asp:ListItem Value=""></asp:ListItem>
  11. <asp:ListItem Value=""></asp:ListItem>
  12. <asp:ListItem Value=""></asp:ListItem>
  13. <asp:ListItem Value=""></asp:ListItem>
  14. <asp:ListItem Value=""></asp:ListItem>
  15. <asp:ListItem Value=""></asp:ListItem>
  16. <asp:ListItem Value=""></asp:ListItem>
  17. <asp:ListItem Value=""></asp:ListItem>
  18. <asp:ListItem Value=""></asp:ListItem>
  19. <asp:ListItem Value=""></asp:ListItem>
  20. <asp:ListItem Value=""></asp:ListItem>
  21. <asp:ListItem Value=""></asp:ListItem>
  22. <asp:ListItem Value=""></asp:ListItem>
  23. <asp:ListItem Value=""></asp:ListItem>
  24. <asp:ListItem Value=""></asp:ListItem>
  25. <asp:ListItem Value=""></asp:ListItem>
  26. <asp:ListItem Value=""></asp:ListItem>
  27. <asp:ListItem Value=""></asp:ListItem>
  28. <asp:ListItem Value=""></asp:ListItem>
  29. <asp:ListItem Value=""></asp:ListItem>
  30. <asp:ListItem Value=""></asp:ListItem>
  31. <asp:ListItem Value=""></asp:ListItem>
  32. <asp:ListItem Value=""></asp:ListItem>
  33. <asp:ListItem Value=""></asp:ListItem>
  34. <asp:ListItem Value=""></asp:ListItem>
  35. <asp:ListItem Value=""></asp:ListItem>
  36. <asp:ListItem Value=""></asp:ListItem>
  37. <asp:ListItem Value=""></asp:ListItem>
  38. <asp:ListItem Value=""></asp:ListItem>
  39. <asp:ListItem Value=""></asp:ListItem>
  40. <asp:ListItem Value=""></asp:ListItem>
  41. <asp:ListItem Value=""></asp:ListItem>
  42. <asp:ListItem Value=""></asp:ListItem>
  43. <asp:ListItem Value=""></asp:ListItem>
  44. <asp:ListItem Value=""></asp:ListItem>
  45. <asp:ListItem Value=""></asp:ListItem>
  46. <asp:ListItem Value=""></asp:ListItem>
  47. <asp:ListItem Value=""></asp:ListItem>
  48. <asp:ListItem Value=""></asp:ListItem>
  49. <asp:ListItem Value=""></asp:ListItem>
  50. <asp:ListItem Value=""></asp:ListItem>
  51. <asp:ListItem Value=""></asp:ListItem>
  52. <asp:ListItem Value=""></asp:ListItem>
  53. <asp:ListItem Value=""></asp:ListItem>
  54. <asp:ListItem Value=""></asp:ListItem>
  55. <asp:ListItem Value=""></asp:ListItem>
  56. <asp:ListItem Value=""></asp:ListItem>
  57. <asp:ListItem Value=""></asp:ListItem>
  58. <asp:ListItem Value=""></asp:ListItem>
  59. <asp:ListItem Value=""></asp:ListItem>
  60. <asp:ListItem Value=""></asp:ListItem>
  61. <asp:ListItem Value=""></asp:ListItem>
  62. <asp:ListItem Value=""></asp:ListItem>
  63. <asp:ListItem Value=""></asp:ListItem>
  64. <asp:ListItem Value=""></asp:ListItem>
  65. <asp:ListItem Value=""></asp:ListItem>
  66. <asp:ListItem Value=""></asp:ListItem>
  67. <asp:ListItem Value=""></asp:ListItem>
  68. <asp:ListItem Value=""></asp:ListItem>
  69. <asp:ListItem Value=""></asp:ListItem>
  70. <asp:ListItem Value=""></asp:ListItem>
  71. <asp:ListItem Value=""></asp:ListItem>
  72. <asp:ListItem Value=""></asp:ListItem>
  73. <asp:ListItem Value=""></asp:ListItem>
  74. <asp:ListItem Value=""></asp:ListItem>
  75. <asp:ListItem Value=""></asp:ListItem>
  76. <asp:ListItem Value=""></asp:ListItem>
  77. <asp:ListItem Value=""></asp:ListItem>
  78. <asp:ListItem Value=""></asp:ListItem>
  79. <asp:ListItem Value=""></asp:ListItem>
  80. <asp:ListItem Value=""></asp:ListItem>
  81. <asp:ListItem Value=""></asp:ListItem>
  82. <asp:ListItem Value=""></asp:ListItem>
  83. <asp:ListItem Value=""></asp:ListItem>
  84. <asp:ListItem Value=""></asp:ListItem>
  85. <asp:ListItem Value=""></asp:ListItem>
  86. <asp:ListItem Value=""></asp:ListItem>
  87. <asp:ListItem Value=""></asp:ListItem>
  88. <asp:ListItem Value=""></asp:ListItem>
  89. <asp:ListItem Value=""></asp:ListItem>
  90. <asp:ListItem Value=""></asp:ListItem>
  91. <asp:ListItem Value=""></asp:ListItem>
  92. <asp:ListItem Value=""></asp:ListItem>
  93. <asp:ListItem Value=""></asp:ListItem>
  94. <asp:ListItem Value=""></asp:ListItem>
  95. <asp:ListItem Value=""></asp:ListItem>
  96. <asp:ListItem Value=""></asp:ListItem>
  97. <asp:ListItem Value=""></asp:ListItem>
  98. <asp:ListItem Value=""></asp:ListItem>
  99. <asp:ListItem Value=""></asp:ListItem>
  100. </asp:DropDownList>

  101. <asp:DropDownList ID="DropDownListMonth" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListMonth_SelectedIndexChanged">
  102. <asp:ListItem Value=""></asp:ListItem>
  103. <asp:ListItem Value=""></asp:ListItem>
  104. <asp:ListItem Value=""></asp:ListItem>
  105. <asp:ListItem Value=""></asp:ListItem>
  106. <asp:ListItem Value=""></asp:ListItem>
  107. <asp:ListItem Value=""></asp:ListItem>
  108. <asp:ListItem Value=""></asp:ListItem>
  109. <asp:ListItem Value=""></asp:ListItem>
  110. <asp:ListItem Value=""></asp:ListItem>
  111. <asp:ListItem Value=""></asp:ListItem>
  112. <asp:ListItem Value=""></asp:ListItem>
  113. <asp:ListItem Value=""></asp:ListItem>
  114. </asp:DropDownList>

  115. <asp:DropDownList ID="DropDownListDay" runat="server">
  116. <asp:ListItem Value=""></asp:ListItem>
  117. <asp:ListItem Value=""></asp:ListItem>
  118. <asp:ListItem Value=""></asp:ListItem>
  119. <asp:ListItem Value=""></asp:ListItem>
  120. <asp:ListItem Value=""></asp:ListItem>
  121. <asp:ListItem Value=""></asp:ListItem>
  122. <asp:ListItem Value=""></asp:ListItem>
  123. <asp:ListItem Value=""></asp:ListItem>
  124. <asp:ListItem Value=""></asp:ListItem>
  125. <asp:ListItem Value=""></asp:ListItem>
  126. <asp:ListItem Value=""></asp:ListItem>
  127. <asp:ListItem Value=""></asp:ListItem>
  128. <asp:ListItem Value=""></asp:ListItem>
  129. <asp:ListItem Value=""></asp:ListItem>
  130. <asp:ListItem Value=""></asp:ListItem>
  131. <asp:ListItem Value=""></asp:ListItem>
  132. <asp:ListItem Value=""></asp:ListItem>
  133. <asp:ListItem Value=""></asp:ListItem>
  134. <asp:ListItem Value=""></asp:ListItem>
  135. <asp:ListItem Value=""></asp:ListItem>
  136. <asp:ListItem Value=""></asp:ListItem>
  137. <asp:ListItem Value=""></asp:ListItem>
  138. <asp:ListItem Value=""></asp:ListItem>
  139. <asp:ListItem Value=""></asp:ListItem>
  140. <asp:ListItem Value=""></asp:ListItem>
  141. <asp:ListItem Value=""></asp:ListItem>
  142. <asp:ListItem Value=""></asp:ListItem>
  143. <asp:ListItem Value=""></asp:ListItem>
  144. <asp:ListItem Value=""></asp:ListItem>
  145. <asp:ListItem Value=""></asp:ListItem>
  146. <asp:ListItem Value=""></asp:ListItem>
  147. </asp:DropDownList>

  148. </ContentTemplate>
  149. </asp:UpdatePanel>
  1. protected void DropDownListYear_SelectedIndexChanged(object sender, EventArgs e)
  2.         {
  3.             DropDownListDay.SelectedIndex = 0;
  4.         }
  5.  
  6.         protected void DropDownListMonth_SelectedIndexChanged(object sender, EventArgs e)
  7.         {
  8.             switch (DropDownListMonth.SelectedValue)
  9.             {
  10.                 case "1":
  11.                 case "3":
  12.                 case "5":
  13.                 case "7":
  14.                 case "8":
  15.                 case "10":
  16.                 case "12":
  17.                     DropDownListDay.Items.Clear();
  18.                     for (int i = 1; i <= 31; i++)
  19.                     {
  20.                         DropDownListDay.Items.Add(new ListItem(Convert.ToString(i), Convert.ToString(i)));
  21.                     }
  22.                     break;
  23.                 case "4":
  24.                 case "6":
  25.                 case "9":
  26.                 case "11":
  27.                     DropDownListDay.Items.Clear();
  28.                     for (int i = 1; i <= 30; i++)
  29.                     {
  30.                         DropDownListDay.Items.Add(new ListItem(Convert.ToString(i), Convert.ToString(i)));
  31.                     }
  32.                     break;
  33.                 case "2":
  34.                     DropDownListDay.Items.Clear();
  35.                     if ((Convert.ToInt32(DropDownListYear.SelectedValue) % 4 == 0) || (Convert.ToInt32(DropDownListYear.SelectedValue) % 100 == 0))
  36.                     {
  37.                         for (int i = 1; i <= 29; i++)
  38.                         {
  39.                             DropDownListDay.Items.Add(new ListItem(Convert.ToString(i), Convert.ToString(i)));
  40.                         };
  41.                     }
  42.                     else
  43.                     {
  44.                         for (int i = 1; i <= 28; i++)
  45.                         {
  46.                             DropDownListDay.Items.Add(new ListItem(Convert.ToString(i), Convert.ToString(i)));
  47.                         };
  48.                     }
  49.                     break; 
  50.             }
  51.         }

代码直接贴入就可以运行,没什么技术含量不多做说明,如果觉得年份太多可以自己放到xml文件中!

ASP.NET实现年月日三级联动(局部刷新)的更多相关文章

  1. ASP.NET实现省市区三级联动(局部刷新)

    跟前一篇ASP.NET实现年月日三级联动(局部刷新)一样,没什么技术含量,直接上代码 <asp:ScriptManager ID="ScriptManager1" runat ...

  2. 利用select实现年月日三级联动的日期选择效果

    × 目录 [1]演示 [2]规划 [3]结构生成[4]算法处理 前面的话 关于select控件,可能年月日三级联动的日期选择效果是最常见的应用了.本文是选择框脚本的实践,下面将对日期选择效果进行详细介 ...

  3. JS年月日三级联动下拉框日期选择代码

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. JS 实现的年月日三级联动

    js文件 SYT="-请选择年份-"; SMT="-请选择月份-"; SDT="-请选择日期-"; BYN=50;//年份范围往前50年 A ...

  5. 时间操作(JavaScript版)—年月日三级联动(默认显示系统时间)

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/wangshuxuncom/article/details/35263317         这个功能 ...

  6. JS实现年月日三级联动+省市区三级联动+国家省市三级联动

    开篇随笔:最近项目需要用到关于年月日三级联动以及省市区三级联动下拉选择的功能,于是乎网上搜了一些做法,觉得有一些只是给出了小的案例或者只有单纯的js还不完整,却很难找到详细的具体数据(baidu搜索都 ...

  7. MVC三级联动无刷新

    本篇实现有关客户.订单和产品的无刷新三级联动,先看最终效果: 没有选择时,后2个Select状态为禁用: 当选择第1个Select,第2个Select可供选择,第3个Select依旧禁用: 当选择第2 ...

  8. js实现年月日三级联动

    当我们注册一个qq的时候,会看到一个三级年月日的联动菜单,下面简单介绍. <!doctype html> <html lang="en"> <head ...

  9. asp.net mvc3 利用Ajax实现局部刷新

    1.利用Ajax.ActionLink()方法 首先在_Layout.cshtml文件中加载 运行AJAX必要的Jquery <script src="@Url.Content(&qu ...

随机推荐

  1. BZOJ 1688: Disease Manangement (子集枚举)

    Disease Manangement Q - 枚举子集 Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d &a ...

  2. python 深拷贝和浅拷贝浅析

    简单点说 1. copy.copy 浅拷贝 只拷贝父对象,不会拷贝对象的内部的子对象.id会变化2. copy.deepcopy 深拷贝 拷贝对象及其子对象.id会变化 >>> im ...

  3. JVM笔记-逃逸分析

    参考: http://www.iteye.com/topic/473355http://blog.sina.com.cn/s/blog_4b6047bc01000avq.html 什么是逃逸分析(Es ...

  4. JVM笔记-temp

    jvm源码分析之堆外内存完全解读 http://lovestblog.cn/blog/2015/05/12/direct-buffer/

  5. 打印机PCL漏洞原理分析

    0x01 漏洞概要 PCL代表打印机控制语言(Printer Control Language),由惠普公司开发,并被广泛使用的一种打印机协议.关于另一种页面描述语言,应该提一提由Adobe设计的Po ...

  6. InstallShield FEQ

    Q: 如何替换setup.exe的图标? A: 这不是一个推荐的操作,因为可能会引起不可预见的错误,而且IS没有开放这个接口.如果你坚持要这么做,可以使用第三方软件比如ExeScope来进行图标替换. ...

  7. 2048 swift

    AppearanceProvider.swift import UIKit protocol AppearanceProviderProtocol:class { func tileColor(val ...

  8. 14.1.2 InnoDB表最佳实践:

    14.1.2 Best Practices for InnoDB Tables InnoDB表最佳实践: 这个章节描述使用InnoDB表最佳实践: 1.指定一个主键用于每个表使用最多查询的列或者多列, ...

  9. ldd显示可执行模块的dependenc

    ldd的作用是打印可执行档依赖的共享库文件.它是glibc的一部分,由Roland McGrath和Ulrich Drepper维护:$ ldd --versionldd (GNU libc) 2.9 ...

  10. -_-#【userAgent】极速模式与非极速模式存在差异

    UC浏览器 Android 极速模式 UC浏览器 Android 非极速模式