Ejemplo n.º 1
0
        protected void GridViewCommand(object sender, GridViewCommandEventArgs e)
        {
            int    index      = Convert.ToInt16(e.CommandArgument);
            string Sourcepath = Server.MapPath("~/upload/Temp/");
            string Despath    = Server.MapPath("~/upload/Affix/");
            int    affixid    = 0; //int.Parse(this.GridView1.Rows[index].Cells[0].Text.Trim());


            try
            {
                if (File.Exists(Sourcepath + this.GridView1.Rows[index].Cells[2].Text))
                {
                    File.Delete(Sourcepath + this.GridView1.Rows[index].Cells[2].Text);
                }
                if (File.Exists(Despath + this.GridView1.Rows[index].Cells[2].Text))
                {
                    File.Delete(Despath + this.GridView1.Rows[index].Cells[2].Text);
                }

                affixid = int.Parse(this.GridView1.Rows[index].Cells[0].Text);
            }
            catch { }


            Maticsoft.BLL.NewsManage.NewsAffix bll = new Maticsoft.BLL.NewsManage.NewsAffix();
            bll.Delete(affixid);

            DataSet Ds = bll.GetNewsAffixList(-1, NewsId, false); //bll.GetTopScroll(4);//

            this.GridView1.DataSource = Ds;                       // Dbs.BindGrid("document_info_pic", "*", "where Articleid='" + this.Label_ArticleId.Text + "'", "");
            this.GridView1.DataBind();

            this.Label_Msg.Text  = "已经上传了 " + this.GridView1.Rows.Count.ToString() + " 个文件,您可以删除已上传文件,如需修改文件,请先该上传文件,再重新上传!";
            this.Button1.Enabled = (this.GridView1.Rows.Count > 0);
        }
Ejemplo n.º 2
0
        protected void GridViewCommand(object sender, GridViewCommandEventArgs e)
        {
            int index = Convert.ToInt16(e.CommandArgument);
            string Sourcepath = Server.MapPath("~/upload/Temp/");
            string Despath = Server.MapPath("~/upload/Affix/");
            int affixid = 0; //int.Parse(this.GridView1.Rows[index].Cells[0].Text.Trim());

         
            try
            {
                if (File.Exists(Sourcepath + this.GridView1.Rows[index].Cells[2].Text))
                    File.Delete(Sourcepath + this.GridView1.Rows[index].Cells[2].Text);
                if (File.Exists(Despath + this.GridView1.Rows[index].Cells[2].Text))
                    File.Delete(Despath + this.GridView1.Rows[index].Cells[2].Text);

                affixid = int.Parse(this.GridView1.Rows[index].Cells[0].Text);

            }
            catch { }


            Maticsoft.BLL.NewsManage.NewsAffix bll = new Maticsoft.BLL.NewsManage.NewsAffix();
            bll.Delete(affixid);

            DataSet Ds = bll.GetNewsAffixList(-1, NewsId, false); //bll.GetTopScroll(4);//
            this.GridView1.DataSource = Ds;// Dbs.BindGrid("document_info_pic", "*", "where Articleid='" + this.Label_ArticleId.Text + "'", "");
            this.GridView1.DataBind();      

            this.Label_Msg.Text = "已经上传了 " + this.GridView1.Rows.Count.ToString() + " 个文件,您可以删除已上传文件,如需修改文件,请先该上传文件,再重新上传!";
            this.Button1.Enabled = (this.GridView1.Rows.Count > 0);
        }