当前位置:网站首页>WebForm DropDownList分别绑定年月
WebForm DropDownList分别绑定年月
2022-08-02 07:15:00 【太阳的后裔】
WebForm DropDownList分别绑定年月
小编今天又开始了新的需求,然后也就会遇见不一样的知识,来和小编一起见识一下吧

图为需求者做的,要求是从去年开始的,所以小的年份就是2021,后面跟着一个月份下拉框,两者默认情况都要选中本年本月,这样的需求有没有让你想要试一试的冲动?来吧,展示
<form runat="server">
<div class="clearfix mt15">
<div class="fl sx-bt">时间:</div>
<div class="fl fw-ed">
<div class="fl">
<asp:DropDownList ID="ddlYear" runat="server" CssClass="textbox-3"></asp:DropDownList>
</div>
<asp:DropDownList ID="ddlMonth" runat="server" CssClass="textbox-3"></asp:DropDownList>
</div>
</div>
</div>
</form>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BandTime();
}
}
private void Bind()
{
BandTime();
}
private void BandTime() {
ddlYear.Items.Clear();
for (int i= System.DateTime.Now.Year; i>=2021;i--) {
ListItem li = new ListItem(i.ToString()+"年", i.ToString());
ddlYear.Items.Add(li);
}
ddlMonth.Items.Clear();
for (int i = 12; i >= 1; i--)
{
ListItem li = new ListItem(i.ToString() + "月", i.ToString());
ddlMonth.Items.Add(li);
}
ddlMonth.SelectedValue = System.DateTime.Now.Month.ToString();
}
得了肠胃炎,然后吃了两周的斋饭,本周终于好了些,然后开始吃肉,结果精神不好
结论:吃肉真的会增加肠胃负担。要想工作精神些,最好多吃素。
边栏推荐
- Enterprise training and reproduction guidebook - training and reasoning of the OpenPose model based on Huawei ModelArts platform, realizing the recognition of two behaviors of climbing and climbing ov
- 在VMware上安装Metasploitable2
- Please tell me, how to write Flink SQL and JDBC sink into mysql library and want to create an auto-incrementing primary key
- hdu1752 copy
- LeetCode 2360. 图中的最长环
- MySQL - low level settings
- CollectionUtil: a collection of functional style tool
- playwright 爬虫使用
- 【ROS基础】rosbag 的使用方法
- 机器学习笔记--数学库
猜你喜欢

通过建立新的SaaS业务来推动增长的六种方法

Conditional constructor ~wapper

自然语言处理 文本预处理(下)(张量表示、文本数据分析、文本特征处理等)

spark架构

Introduction to mysql operation (4) ----- data sorting (ascending, descending, multi-field sorting)

【ROS基础】map、odom、base_link、laser 的理解 及其 tf 树的理解

论文阅读 (64):Weakly-supervised Video Anomaly Detection with Robust Temporal Feature Magnitude Learning

【CV】OpenVINO安装教程

主流定时任务解决方案全横评

LeetCode 2312. 卖木头块
随机推荐
OC-错误提示
MPLS和BGP的综合实验
论文阅读 (64):Weakly-supervised Video Anomaly Detection with Robust Temporal Feature Magnitude Learning
A Preliminary Study on the Basic Principles of Formal Methods
OC-NSArray
以训辅教,以战促学 | 新版攻防世界平台正式上线运营!
Data reveal that the average cost is as high as $4.35 million in 2022, a record!
带手续费买卖股票的最大利益[找DP的状态定义到底缺什么?]
LeetCode 2360. The longest cycle in a graph
hdu1752 copy
OC-NSString
MySQL-Execution Process + Cache + Storage Engine
逆变器绝缘检测检测功能及软件实现
SQL server 2014 怎么一次性导出多个查询结果?
spark架构
暑假第五周总结
OC-NSNumber and NSValue are generally used for boxing and unboxing
apt & apt-get命令
问个问题,我的Flinkcdc已经跑通了,可以监听msql的binlog了,也能发送kafk
Introduction to Totem Pole and Push-Pull Circuits