Пример #1
0
        protected void grdTip_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);
                    DetailsViewTip.DataSource = ayarlar.tipListesiTekliR(code2);
                    DetailsViewTip.DataBind();
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#detailModalTip').modal('show');");
                    sb.Append(@"</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DetailModalScriptTip", 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.tipSilR(code2);;

                        grdTip.DataSource = ayarlar.tipListesiGrid();
                        grdTip.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(), "EditHideModalScriptTip", sb.ToString(), false);
                    }
                }
            }
            else if (e.CommandName.Equals("editRecord"))
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow gvrow = grdTip.Rows[index];

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

                txtTipID.Value       = HttpUtility.HtmlDecode(gvrow.Cells[1].Text);
                txtTipAd.Text        = HttpUtility.HtmlDecode(link.Text);
                txtTipAciklama.Text  = HttpUtility.HtmlDecode(gvrow.Cells[3].Text);
                txtCssGuncelle.Value = HttpUtility.HtmlDecode(gvrow.Cells[4].Text);

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