protected void ASPxGridView2_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
 {
     try
     {
         DeleteFiles df = new DeleteFiles();
         df.DeleteAllFiles(Convert.ToInt32(e.Keys[0]), articleId);
         dll_Research_Article dll = new dll_Research_Article(username, dr.getDurationId());
         dll.deleteData(Convert.ToInt32(((HiddenField)ASPxGridView2.FindRowCellTemplateControl(ASPxGridView2.FindVisibleIndexByKeyValue(e.Keys[ASPxGridView2.KeyFieldName]), (GridViewDataColumn)ASPxGridView2.Columns["ArticleName"], "hidDeleteId")).Value));
         e.Cancel = true;
         FillGridView2();
     }
     catch (Exception)
     {
     }
 }
        protected void ASPxGridView2_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            Article ac = new Article();

            ac.ArticleId = Convert.ToInt32(((HiddenField)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ArticleName"], "hidEditId")).Value);
            ac.ArticleName = ((TextBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ArticleName"], "txtEditArticleName")).Text;
            ac.PublishTypeId = Convert.ToInt32(((ASPxComboBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["PublishTypeId"], "ddEditPublishTypeId")).Value);
            ac.ResearchId = Convert.ToInt32(((ASPxComboBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ResearchName"], "ddEditResearchId")).Value);

            dll_Research_Article dll = new dll_Research_Article(username, dr.getDurationId());
            dll.updateData(ac);
            this.ASPxGridView2.CancelEdit();
            e.Cancel = true;
            FillGridView2();
        }
        protected void ASPxGridView2_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            Article ac = new Article();

            ac.UserName = username;
            ac.DurationId = durationId;

            ac.ArticleName = ((TextBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ArticleName"], "txtEditArticleName")).Text;
            ac.PublishTypeId = Convert.ToInt32(((ASPxComboBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["PublishTypeId"], "ddEditPublishTypeId")).Value);
            ac.ResearchId = Convert.ToInt32(((ASPxComboBox)ASPxGridView2.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView2.Columns["ResearchId"], "ddEditResearchId")).Value);

            dll_Research_Article dll = new dll_Research_Article(username, durationId);
            dll.insertData(ac);
            e.Cancel = true;
            ASPxGridView2.CancelEdit();
            FillGridView2();
        }