示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DropDownListBolum.DataSource     = bolumislem.Getir().Where(p => p.IsActive == true);
         DropDownListBolum.DataValueField = "Id";
         DropDownListBolum.DataTextField  = "Name";
         DropDownListBolum.DataBind();
         DropDownListBolum.Items.Insert(0, new ListItem("Bölüm Seçiniz..", "0"));
     }
 }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["UserId"] != null || Session["SuperUserId"] != null)
                {
                    int gelenid;
                    if (Session["SuperUserId"] != null)
                    {
                        gelenid = Convert.ToInt32(Session["SuperUserId"]);
                    }
                    else
                    {
                        gelenid = Convert.ToInt32(Session["UserId"]);
                    }

                    users = kullanici.TekGetir(gelenid);
                    if (users.IsSuperAdmin == true)
                    {
                        DropDownListBolum.DataSource     = bolumislem.Getir().Where(p => p.IsActive == true);
                        DropDownListBolum.DataValueField = "Id";
                        DropDownListBolum.DataTextField  = "Name";
                        DropDownListBolum.DataBind();
                        DropDownListBolum.Items.Insert(0, new ListItem("Bölüm Seçiniz..", "0"));
                    }
                    else
                    {
                        DropDownListBolum.DataSource     = bolumislem.Getir().Where(p => p.IsActive == true && p.Id == users.SectionID);
                        DropDownListBolum.DataValueField = "Id";
                        DropDownListBolum.DataTextField  = "Name";
                        DropDownListBolum.DataBind();
                        DropDownListBolum.Items.Insert(0, new ListItem("Bölüm Seçiniz..", "0"));
                    }
                }
            }
        }