首页 > 其他 > 详细

GridView Footer模板列中给Dropdownlist赋值

时间:2015-04-13 22:38:30      阅读:312      评论:0      收藏:0      [点我收藏+]

 

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    string FstWeekEnd,FstWeekEndday;

    if (e.Row.RowType == DataControlRowType.Footer)
    {
        DropDownList ddl = (DropDownList)e.Row.FindControl("new_date");
        for (int i = 0; i < 7; i++)
        {
            FstWeekEnd = DateTime.Now.AddDays(Convert.ToDouble((1 - Convert.ToInt16(DateTime.Now.DayOfWeek))) + 14 + i).ToString("yyyy-MM-dd");

            FstWeekEndday = DateTime.Now.AddDays(Convert.ToDouble((1 - Convert.ToInt16(DateTime.Now.DayOfWeek))) + 14 + i).ToString("MM-dd");

            ddl.Items.Add(new ListItem(FstWeekEndday, FstWeekEnd));

        }
    }
}

GridView Footer模板列中给Dropdownlist赋值

原文:http://www.cnblogs.com/pp521/p/4423388.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!