Exemplo n.º 1
0
        public void Listarpermisos()
        {
            try
            {
                String bd          = Session["BD"].ToString();
                var    registros16 = Controlasql.Clistadomenus(bd);

                if (registros16.Tables[0].Rows.Count > 0)
                {
                    Gridviewpermisos.DataSource = registros16;
                    Gridviewpermisos.DataBind();
                }
                else
                {
                    Gridviewpermisos.DataSource = null;
                    Gridviewpermisos.DataBind();
                }
            }
            catch (Exception ex)
            {
                excepcion.Visible = true;
                string dato = ex.Message;
                error.InnerText = dato;
            }
        }
Exemplo n.º 2
0
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            table = (System.Data.DataTable)(Session["Tabla"]);
            int       index = Convert.ToInt32(e.RowIndex);
            DataTable dt1   = Session["Tabla"] as DataTable;

            dt1.Rows[index].Delete();
            Session["Tabla"] = dt1;

            Gridviewpermisos.DataSource = dt1;
            Gridviewpermisos.DataBind();
        }
Exemplo n.º 3
0
        protected void agregarow(object sender, EventArgs e)
        {
            table            = (System.Data.DataTable)(Session["Tabla"]);
            row              = table.NewRow();
            row["id_nombre"] = Selectmenuid.Value;

            table.Rows.Add(row);
            Gridviewpermisos.DataSource = table;
            Gridviewpermisos.DataBind();
            Session.Add("Tabla", table);
            Gridviewpermisos.EditIndex = -1;


            //This code allows the user to edit the information in the DataGrid.
        }