在asp.net中的日期甲 [英] date formate in asp.net

查看:51
本文介绍了在asp.net中的日期甲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友下午好,
我已经将dropdownlist与method绑定了(该方法在dropdownlist中显示日期和时间的方式是这样的

good afternoon friends,
i have bind dropdownlist with method(the method display date and time in dropdownlist like this

(9/5/2012 12:00:00am,9/12/2012 12:00:00am,9/21/2012 12:00:00am 10/5/2012 12:00:00am,10/5/2012 12:00:00am and 11/25/2012 12:00:00am,11/30/2012 12:00:00am)


我想显示在
之类的下拉列表中 九月,十月,十一月等……..
下拉列表中仅显示一个月


i want to display in dropdownlist like
September,October,November and so on.............
only single month will be display in dropdownlist

DropDownList.DataTextField = "StartDate";


请帮我一些提示或链接

如果我们一个月中有两个或两个以上日期,则仅对所有月份显示一次
为您添加了代码,请使用改进问题


please help me some hints or links

if we have two or more dates in a month only single month display for all
Added you code, use improve question

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { 
vt.TAuthOccuList dlocc = new vt.TAuthOccuList();
dlocc = ab.GetWebOccurrencesForProgrammeAndDates(Session["token"].ToString(), Convert.ToInt32(Session["ddldate"].ToString()), DateTime.Now, DateTime.Now.AddMonths(8)); DropDownList2.DataSource = dlocc.OccuList; DropDownList2.DataValueField = "occur_id"; DropDownList2.DataTextField = "StartDate"; DropDownList2.DataBind();}

推荐答案

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Data;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {       
        string CurrentMonth = String.Format("{0:MMMM}", DateTime.Now);
        string a = "";
        a = CurrentMonth;

        DropDownList1.DataSource = a;
        DropDownList1.DataBind();
    }
}


这篇关于在asp.net中的日期甲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆