コード例 #1
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("detail"))
            {
                int code2 = Int32.Parse(e.CommandArgument.ToString().Trim());
                using (radiusEntities dc = MyContext.Context(KullaniciIslem.firma()))
                {
                    AyarIslemleri ayarlar = new AyarIslemleri(dc);
                    DetailsView1.DataSource = ayarlar.durumListesiTekliR(code2);
                    DetailsView1.DataBind();
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#detailModal').modal('show');");
                    sb.Append(@"</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DetailModalScript2", sb.ToString(), false);
                }
            }
            else if (e.CommandName.Equals("del"))
            {
                string confirmValue = Request.Form["confirm_value"];
                if (confirmValue == "Yes")
                {
                    int code2 = Int32.Parse(e.CommandArgument.ToString().Trim());

                    using (radiusEntities dc = MyContext.Context(KullaniciIslem.firma()))
                    {
                        AyarIslemleri ayarlar = new AyarIslemleri(dc);
                        ayarlar.durumSilR(code2);;

                        GridView1.DataSource = ayarlar.durumListesiR();
                        GridView1.DataBind();

                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        sb.Append(@"<script type='text/javascript'>");
                        sb.Append(" alertify.success('Kayıt silindi!');");

                        sb.Append(@"</script>");
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript3", sb.ToString(), false);
                    }
                }
            }
            else if (e.CommandName.Equals("editRecord"))
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow gvrow = GridView1.Rows[index];

                LinkButton link = gvrow.Cells[2].Controls[1] as LinkButton;


                lblID.Value = HttpUtility.HtmlDecode(gvrow.Cells[1].Text);

                txtDurum.Text = HttpUtility.HtmlDecode(link.Text);


                chcSMS.Checked  = (gvrow.Cells[3].Controls[0] as CheckBox).Checked;
                chcMail.Checked = (gvrow.Cells[4].Controls[0] as CheckBox).Checked;
                chcWhat.Checked = (gvrow.Cells[5].Controls[0] as CheckBox).Checked;

                if ((gvrow.Cells[6].Controls[0] as CheckBox).Checked)
                {
                    rdDurum.SelectedValue = "son";
                }
                else if ((gvrow.Cells[7].Controls[0] as CheckBox).Checked)
                {
                    rdDurum.SelectedValue = "baslangic";
                }
                else if ((gvrow.Cells[8].Controls[0] as CheckBox).Checked)
                {
                    rdDurum.SelectedValue = "karar";
                }
                else if ((gvrow.Cells[9].Controls[0] as CheckBox).Checked)
                {
                    rdDurum.SelectedValue = "onay";
                }
                else
                {
                    rdDurum.SelectedIndex = -1;
                }


                lblResult.Visible = false;
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#editModal').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditModalScript", sb.ToString(), false);
            }
        }