protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
 {
     DeleteFiles df = new DeleteFiles();
     df.DeleteAllFiles(Convert.ToInt32(e.Keys[0]), directTeachId);
     dll_DirectTeach dt = new dll_DirectTeach(username, dr.getDurationId());
     dt.deleteData(Convert.ToInt32(((HiddenField)ASPxGridView1.FindRowCellTemplateControl(ASPxGridView1.FindVisibleIndexByKeyValue(e.Keys[ASPxGridView1.KeyFieldName]),(GridViewDataColumn)ASPxGridView1.Columns["CourseName"], "hidDeleteId")).Value));
     e.Cancel = true;
     FillGridView();
 }
        protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            DirectTeach drt = new DirectTeach();

            drt.UserName = username;
            drt.DurationId = dr.getDurationId();

            drt.CourseName = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["CourseName"], "txtEditCourseName")).Text;
            drt.StudentGroup = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["StudentGroup"], "txtEditStdGroup")).Text;
            drt.StudentCount = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["StudentCount"], "txtEditStdCount")).Text);
            drt.TheoryCredit = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["TheoryCredit"], "txtEditTheoryCredit")).Text);
            drt.TheoryHours = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["TheoryHours"], "txtEditTheoryHours")).Text);
            drt.PracticeCredit = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PracticeCredit"], "txtEditPracticeCredit")).Text);
            drt.PracticeHours = Convert.ToInt32(((ASPxSpinEdit)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PracticeHours"], "txtEditPracticeHours")).Text);

            dll_DirectTeach dt = new dll_DirectTeach(username, dr.getDurationId());
            dt.insertData(drt);
            //e.Cancel = true;
            //ASPxGridView1.CancelEdit();
            FillGridView();
        }
        //********************************************************************************************
        protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            DirectTeach drt = new DirectTeach();

            drt.DirectTeachId = Convert.ToInt32(((HiddenField)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["CourseName"], "hidId")).Value);
            drt.CourseName = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["CourseName"], "txtEditCourseName")).Text;
            drt.StudentGroup = ((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["StudentGroup"], "txtEditStdGroup")).Text;
            drt.StudentCount = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["StudentCount"], "txtEditStdCount")).Text);
            drt.TheoryCredit = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["TheoryCredit"], "txtEditTheoryCredit")).Text);
            drt.TheoryHours = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["TheoryHours"], "txtEditTheoryHours")).Text);
            drt.PracticeCredit = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PracticeCredit"], "txtEditPracticeCredit")).Text);
            drt.PracticeHours = Convert.ToInt32(((TextBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["PracticeHours"], "txtEditPracticeHours")).Text);

            dll_DirectTeach dt = new dll_DirectTeach(username, durationId);
            dt.updateData(drt);
            this.ASPxGridView1.CancelEdit();
            e.Cancel = true;
            FillGridView();
        }