Ejemplo n.º 1
0
 //刷新
 protected void btnRefresh_Click(object sender, EventArgs e)
 {
     //DropDownList_User.SelectedValue = "0";
     DropDownList_User.Reset();
     DropDownList_Year.Reset();
     //DropDownList_Year.SelectedValue = "0";
     btnDelete.Enabled = false;
     BindData();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Int32 currentyear = Convert.ToInt32(DateTime.Now.Year);
                for (int i = 11; i >= 0; i--)
                {
                    DataBind();
                    DropDownList_Year.Items.Insert(0, Convert.ToString(currentyear - i));
                    DropDownList_Year.Items[0].Value = Convert.ToString(currentyear - i);
                    DataBind();
                }
                DropDownList_Year.DataBind();
                DropDownList_Year.Items.Insert(0, "Select Year");
                DropDownList_Year.Items[0].Value = "";
                DropDownList_Year.SelectedIndex  = 0;

                DropDownList_Class.DataBind();
                DropDownList_Class.Items.Insert(0, "Select Class");
                DropDownList_Class.Items[0].Value = "";
                DropDownList_Class.SelectedIndex  = 0;


                DropDownList_Driver.DataBind();
                DropDownList_Driver.Items.Insert(0, "Select Driver");
                DropDownList_Driver.Items[0].Value = "";
                DropDownList_Driver.SelectedIndex  = 0;

                DropDownList_Officer.DataBind();
                DropDownList_Officer.Items.Insert(0, "Select Officer");
                DropDownList_Officer.Items[0].Value = "";
                DropDownList_Officer.SelectedIndex  = 0;


                DropDownList_ManufacturerId.DataBind();
                DropDownList_ManufacturerId.Items.Insert(0, "Select Manufacturer");
                DropDownList_ManufacturerId.Items[0].Value = "";
                DropDownList_ManufacturerId.SelectedIndex  = 0;
            }
        }
Ejemplo n.º 3
0
 //数据绑定
 public void BindData()
 {
     try
     {
         DropDownList_User.Reset();
         DropDownList_Year.Reset();
         //DropDownList_Year.SelectedValue = "0";//年份绑定初始化
         //DropDownList_User.SelectedValue = "0";//人员名称绑定初始化
         ViewState["page"] = 0;
         //查找小于等于该用户保密级别的所有会议信息
         List <Common.Entities.AcademicMeeting> list = BLLAcademic.FindAll(Convert.ToInt32(Session["SecrecyLevel"]));
         //分页处理
         var res = list.Skip(Grid_MeetingName.PageIndex * Grid_MeetingName.PageSize).Take(Grid_MeetingName.PageSize).ToList();
         Grid_MeetingName.RecordCount     = list.Count();
         this.Grid_MeetingName.DataSource = res;
         this.Grid_MeetingName.DataBind();
         btnDelete.Enabled = false;
     }
     catch (Exception ex)
     {
         publicMethod.SaveError(ex, this.Request);
     }
 }