Exemplo n.º 1
0
        private DataTable SaveGridviewData()
        {
            DataTable dataTable = FileClass.AddColumns();

            foreach (GridViewRow gvRow in gvStrategy.Rows)
            {
                CheckBox     chkDelete          = gvRow.Cells[DELETE_COL_INDEX].FindControl("chkDelete") as CheckBox;
                DropDownList ddlExpiryDates     = gvRow.Cells[EXP_DATE_COL_INDEX].FindControl("ddlExpiryDates") as DropDownList;
                DropDownList ddlContractType    = gvRow.Cells[CONTRACT_TYP_COL_INDEX].FindControl("ddlContractType") as DropDownList;
                DropDownList ddlTransactionType = gvRow.Cells[TRANSTYP_COL_INDEX].FindControl("ddlTransactionType") as DropDownList;
                DropDownList ddlStrikePrice     = gvRow.Cells[SP_COL_INDEX].FindControl("ddlStrikePrice") as DropDownList;
                TextBox      txtPremium         = gvRow.Cells[PREMINUM_COL_INDEX].FindControl("txtPremium") as TextBox;
                DropDownList ddlLots            = gvRow.Cells[LOTS_COL_INDEX].FindControl("ddlLots") as DropDownList;

                dataTable.Rows.Add(chkDelete.Checked, ddlExpiryDates.SelectedValue, ddlContractType.SelectedValue, ddlTransactionType.SelectedValue,
                                   ddlStrikePrice.SelectedValue, "", txtPremium.Text, ddlLots.SelectedValue, "", "", "", "", "", "", "",
                                   "", "", "", "", "", "", "", "", "", "", "", "", "", "");
            }
            return(dataTable);
        }