ASP.NET实现年月日三级联动(局部刷新)
直接上代码,不多说别的了
- <asp:ScriptManager ID="ScriptManager1" runat="server">
- </asp:ScriptManager>
- <asp:UpdatePanel ID="UpdatePanel1" runat="server">
- <ContentTemplate>
- <asp:DropDownList ID="DropDownListYear" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListYear_SelectedIndexChanged">
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- </asp:DropDownList>
- 年
- <asp:DropDownList ID="DropDownListMonth" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListMonth_SelectedIndexChanged">
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- </asp:DropDownList>
- 月
- <asp:DropDownList ID="DropDownListDay" runat="server">
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- <asp:ListItem Value=""></asp:ListItem>
- </asp:DropDownList>
- 日
- </ContentTemplate>
- </asp:UpdatePanel>
- protected void DropDownListYear_SelectedIndexChanged(object sender, EventArgs e)
- {
- DropDownListDay.SelectedIndex = 0;
- }
- protected void DropDownListMonth_SelectedIndexChanged(object sender, EventArgs e)
- {
- switch (DropDownListMonth.SelectedValue)
- {
- case "1":
- case "3":
- case "5":
- case "7":
- case "8":
- case "10":
- case "12":
- DropDownListDay.Items.Clear();
- for (int i = 1; i <= 31; i++)
- {
- DropDownListDay.Items.Add(new ListItem(Convert.ToString(i), Convert.ToString(i)));
- }
- break;
- case "4":
- case "6":
- case "9":
- case "11":
- DropDownListDay.Items.Clear();
- for (int i = 1; i <= 30; i++)
- {
- DropDownListDay.Items.Add(new ListItem(Convert.ToString(i), Convert.ToString(i)));
- }
- break;
- case "2":
- DropDownListDay.Items.Clear();
- if ((Convert.ToInt32(DropDownListYear.SelectedValue) % 4 == 0) || (Convert.ToInt32(DropDownListYear.SelectedValue) % 100 == 0))
- {
- for (int i = 1; i <= 29; i++)
- {
- DropDownListDay.Items.Add(new ListItem(Convert.ToString(i), Convert.ToString(i)));
- };
- }
- else
- {
- for (int i = 1; i <= 28; i++)
- {
- DropDownListDay.Items.Add(new ListItem(Convert.ToString(i), Convert.ToString(i)));
- };
- }
- break;
- }
- }
代码直接贴入就可以运行,没什么技术含量不多做说明,如果觉得年份太多可以自己放到xml文件中!
ASP.NET实现年月日三级联动(局部刷新)的更多相关文章
- ASP.NET实现省市区三级联动(局部刷新)
跟前一篇ASP.NET实现年月日三级联动(局部刷新)一样,没什么技术含量,直接上代码 <asp:ScriptManager ID="ScriptManager1" runat ...
- 利用select实现年月日三级联动的日期选择效果
× 目录 [1]演示 [2]规划 [3]结构生成[4]算法处理 前面的话 关于select控件,可能年月日三级联动的日期选择效果是最常见的应用了.本文是选择框脚本的实践,下面将对日期选择效果进行详细介 ...
- JS年月日三级联动下拉框日期选择代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- JS 实现的年月日三级联动
js文件 SYT="-请选择年份-"; SMT="-请选择月份-"; SDT="-请选择日期-"; BYN=50;//年份范围往前50年 A ...
- 时间操作(JavaScript版)—年月日三级联动(默认显示系统时间)
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/wangshuxuncom/article/details/35263317 这个功能 ...
- JS实现年月日三级联动+省市区三级联动+国家省市三级联动
开篇随笔:最近项目需要用到关于年月日三级联动以及省市区三级联动下拉选择的功能,于是乎网上搜了一些做法,觉得有一些只是给出了小的案例或者只有单纯的js还不完整,却很难找到详细的具体数据(baidu搜索都 ...
- MVC三级联动无刷新
本篇实现有关客户.订单和产品的无刷新三级联动,先看最终效果: 没有选择时,后2个Select状态为禁用: 当选择第1个Select,第2个Select可供选择,第3个Select依旧禁用: 当选择第2 ...
- js实现年月日三级联动
当我们注册一个qq的时候,会看到一个三级年月日的联动菜单,下面简单介绍. <!doctype html> <html lang="en"> <head ...
- asp.net mvc3 利用Ajax实现局部刷新
1.利用Ajax.ActionLink()方法 首先在_Layout.cshtml文件中加载 运行AJAX必要的Jquery <script src="@Url.Content(&qu ...
随机推荐
- BZOJ 1688: Disease Manangement (子集枚举)
Disease Manangement Q - 枚举子集 Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d &a ...
- python 深拷贝和浅拷贝浅析
简单点说 1. copy.copy 浅拷贝 只拷贝父对象,不会拷贝对象的内部的子对象.id会变化2. copy.deepcopy 深拷贝 拷贝对象及其子对象.id会变化 >>> im ...
- JVM笔记-逃逸分析
参考: http://www.iteye.com/topic/473355http://blog.sina.com.cn/s/blog_4b6047bc01000avq.html 什么是逃逸分析(Es ...
- JVM笔记-temp
jvm源码分析之堆外内存完全解读 http://lovestblog.cn/blog/2015/05/12/direct-buffer/
- 打印机PCL漏洞原理分析
0x01 漏洞概要 PCL代表打印机控制语言(Printer Control Language),由惠普公司开发,并被广泛使用的一种打印机协议.关于另一种页面描述语言,应该提一提由Adobe设计的Po ...
- InstallShield FEQ
Q: 如何替换setup.exe的图标? A: 这不是一个推荐的操作,因为可能会引起不可预见的错误,而且IS没有开放这个接口.如果你坚持要这么做,可以使用第三方软件比如ExeScope来进行图标替换. ...
- 2048 swift
AppearanceProvider.swift import UIKit protocol AppearanceProviderProtocol:class { func tileColor(val ...
- 14.1.2 InnoDB表最佳实践:
14.1.2 Best Practices for InnoDB Tables InnoDB表最佳实践: 这个章节描述使用InnoDB表最佳实践: 1.指定一个主键用于每个表使用最多查询的列或者多列, ...
- ldd显示可执行模块的dependenc
ldd的作用是打印可执行档依赖的共享库文件.它是glibc的一部分,由Roland McGrath和Ulrich Drepper维护:$ ldd --versionldd (GNU libc) 2.9 ...
- -_-#【userAgent】极速模式与非极速模式存在差异
UC浏览器 Android 极速模式 UC浏览器 Android 非极速模式