日期:2014-05-17 浏览次数:20471 次
public void ddlBindYMD()
{
DateTime tnow = DateTime.Now;//现在时间
ArrayList AlYear = new ArrayList();
ArrayList AlMonth = new ArrayList();
for (int i = tnow.Year; i >=2000; i--) AlYear.Add(i);
for (int i = 1; i <= 12; i++) AlMonth.Add(i);
//绑定年
ddl_y.DataSource = AlYear;
ddl_y.DataBind();
ddl_y.SelectedValue = tnow.Year.ToString();
//绑定月
ddl_m.DataSource = AlMonth;
ddl_m.DataBind();
ddl_m.SelectedValue = tnow.Month.ToString();
int year=-1;
int month=-1;
year = Int32.Parse(ddl_y.SelectedValue);
month = Int32.Parse(ddl_m.SelectedValue);
//ddl_d.SelectedValue = tnow.Day.ToString();
BindDays(year, month); //根据年月 绑定 日期
}
//这是我从数据库中 分别读取出来的 年 月 日
string year =Convert.ToString((DateTime)model.ReleaseDate).Year)) ;
string month=Convert.ToString((DateTime)model.ReleaseDate).Month)) ;
string day =Convert.ToString((DateTime)model.ReleaseDate).Day)) ;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>简单的数据列表举例</title>
<script src="Js/jquery-1.4.2.min.js" type="text/javascript"></script>
<style type="text/css">
input, textarea {width: 100px;border-top: solid 1px #999;border-right: solid 1px #CCC;border-left: solid 1px #CCC;
border-bottom: solid 1px #EEE;padding: 5px 8px;border-radius: 2px;line-height: 12px;color: #999;vertical-align: middle;}<