Ejemplo n.º 1
0
        protected void top_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ImageButton action       = (ImageButton)e.CommandSource;
            string      actionString = action.ID;

            if (action.ID.Equals("delete"))
            {
                try
                {
                    Document document = new Document();
                    string   id       = ((Label)document_list.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    document.Id = Int32.Parse(id);
                    DeleteDocumentCommand cmd = new DeleteDocumentCommand(document);
                    cmd.Execute();
                    if (document.Code == 200)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme()", true);
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertmeErr()", true);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else if (action.ID.Equals("modify"))
            {
                try
                {
                    string id = ((Label)document_list.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    Session["Id_doc"] = id;
                    Response.Redirect("/site/admin/adm_content/edit_doc.aspx");
                }
                catch (Exception ex)
                {
                }
            }
        }