コード例 #1
0
        protected void GridviewSiniflar_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "aktif")
            {
                int userID = Convert.ToInt32(e.CommandArgument);



                Trainer c = islem.TekGetir(userID);


                if (c.IsActive == true)
                {
                    if (islem.DurumGuncelle(userID, false))
                    {
                        Doldur();
                    }
                }
                else
                {
                    if (islem.DurumGuncelle(userID, true))
                    {
                        Doldur();
                    }
                }
            }

            GridViewRow secilenSatir;
            int         id;


            switch (e.CommandName)
            {
            case "duzenle":

                secilenSatir = (e.CommandSource as LinkButton).Parent.Parent as GridViewRow;
                id           = Convert.ToInt32(e.CommandArgument);
                GridviewSiniflar.EditIndex = secilenSatir.RowIndex;
                Doldur();


                break;

            case "guncelle":


                secilenSatir = (e.CommandSource as LinkButton).Parent.Parent as GridViewRow;
                id           = Convert.ToInt32(e.CommandArgument);

                System.Web.UI.WebControls.DropDownList ddl1 = (System.Web.UI.WebControls.DropDownList)(secilenSatir.FindControl("dropdownBolum"));
                System.Web.UI.WebControls.TextBox      txt4 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtAd"));
                System.Web.UI.WebControls.TextBox      txt5 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtAcilis"));
                System.Web.UI.WebControls.TextBox      txt6 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtSoyad"));
                System.Web.UI.WebControls.TextBox      txt7 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtusername"));
                System.Web.UI.WebControls.TextBox      txt8 = (System.Web.UI.WebControls.TextBox)(secilenSatir.FindControl("txtmail"));

                Trainer trainer = islem.TekGetir(id);
                trainer.EMail     = txt8.Text;
                trainer.FirstName = txt4.Text;
                trainer.LastName  = txt6.Text;
                trainer.Username  = txt7.Text;
                trainer.FullName  = txt4.Text + "" + txt6.Text;
                trainer.SectionID = Convert.ToInt32(ddl1.SelectedValue);

                if (islem.Guncelle(trainer))
                {
                    GridviewSiniflar.EditIndex = -1;
                    Doldur();
                }



                break;

            case "iptal":

                GridviewSiniflar.EditIndex = -1;
                Doldur();

                break;

            default:
                break;
            }
        }