예제 #1
0
        /// <summary>
        /// Function to bindings the grid view data.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnGridViewDataBinding(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)   //skip header row
            {
                IEmployee objEmployee = (IEmployee)e.Row.DataItem;

                IAdminBLL    objBLL   = AdminBLLFactory.CreateAdminBLLObject();
                List <IRole> roleList = objBLL.GetRoleList();

                DropDownList ddlRoleList = (DropDownList)e.Row.FindControl("ddlNewRole");

                if (ddlRoleList != null)
                {
                    ddlRoleList.AppendDataBoundItems = true;
                    ListItem lst = new ListItem("Select Role", "0");
                    ddlRoleList.Items.Add(lst);
                    ddlRoleList.DataSource     = roleList;
                    ddlRoleList.DataTextField  = "RoleName";
                    ddlRoleList.DataValueField = "RoleId";
                    ddlRoleList.DataBind();
                }
            }
        }
        /// <summary>
        /// This is the page load method for add/ update employee
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            calenderDOB.StartDate = Convert.ToDateTime("01/01/1960");
            calenderDOB.EndDate   = Convert.ToDateTime("01 / 01 / 2005");
            calenderDOJ.StartDate = DateTime.Today.AddMonths(-1);
            calenderDOJ.EndDate   = DateTime.Today;

            calenderDOJ.SelectedDate = DateTime.Today;



            IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject();

            List <IRole> lstRole = objBLL.GetRoleList();

            if (!IsPostBack)
            {
                ddlRole.DataSource     = lstRole;
                ddlRole.DataTextField  = "RoleName";
                ddlRole.DataValueField = "RoleId";
                ddlRole.DataBind();
            }
        }