protected void SubmitCheckedDoc_Click(object sender, EventArgs e)
    {
        //initialize values
        int collateralId = Convert.ToInt32(Request.QueryString["collateralId"]);
        int CollateralTypeId = Convert.ToInt32(Request.QueryString["CollateralTypeId"]);
        int CollateralDetailsId = Convert.ToInt32(hiddenDetailsId.Text);


        RobotTableAdapters.documents_submittedTableAdapter robotDocs = new RobotTableAdapters.documents_submittedTableAdapter();
        RobotTableAdapters.documents_attachmentTableAdapter robotAttachment = new RobotTableAdapters.documents_attachmentTableAdapter();

        //delete should happen before insert, just incase the guy goes back to check or uncheck documents in the checklist tab

        robotDocs.DeleteExistingCheckedDocs(collateralId, CollateralDetailsId, CollateralTypeId);
        DataTable checkDocs = robotDocs.getSubmitedDocumentsById(140, 47, 1);

        foreach (ListItem item in CheckBoxList1.Items)
        {
            if (item.Selected)
            {
                robotDocs.Insert(Convert.ToInt32(item.Value), collateralId, CollateralDetailsId, CollateralTypeId, 1, Smart.GetEmployeeID());
            }
        }

        //popolate the documents for attachment
        robotAttachment.proc_DeleteAlreadyPopulatedDocsBeforeInsert(collateralId, CollateralDetailsId, CollateralTypeId);
        robotAttachment.Proc_populateDocumentsAttachment(collateralId.ToString(), CollateralDetailsId.ToString(), CollateralTypeId.ToString());


        ASPxGridView1.DataBind();
        ASPxGridView2.DataBind();

        //enable and move focus to next tab, disable current tab
        ASPxPageControl1.TabPages[2].Enabled = true;
        ASPxPageControl1.TabPages[1].Enabled = true;
        ASPxPageControl1.TabPages[0].Enabled = true;

        ASPxPageControl1.ActiveTabIndex = 2;
        CheckBoxList1_Load();
    }