private void BindPOAddEdit(string mrp_number, string type)
        {
            DataTable dtRecord = MRPClass.POAddEdit_Table(mrp_number, type);

            POAddEditGrid.DataSource   = dtRecord;
            POAddEditGrid.KeyFieldName = "PK";
            POAddEditGrid.DataBind();

            //for row updating
            DataSet ds = new DataSet();

            ds.Tables.Add(dtRecord);
            Session["DataSet"] = ds;
        }
        protected void POAddEditGrid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxTextBox qty   = POAddEditGrid.FindEditRowCellTemplateControl((GridViewDataColumn)POAddEditGrid.Columns["POQty"], "POQty") as ASPxTextBox;
            ASPxTextBox cost  = POAddEditGrid.FindEditRowCellTemplateControl((GridViewDataColumn)POAddEditGrid.Columns["POCost"], "POCost") as ASPxTextBox;
            ASPxTextBox total = POAddEditGrid.FindEditRowCellTemplateControl((GridViewDataColumn)POAddEditGrid.Columns["POTotalCost"], "POTotalCost") as ASPxTextBox;
            //ASPxGridView grid = sender as ASPxGridView;
            //MRPClass.PrintString(e.NewValues["POQty"].ToString());
            //e.Cancel = true;
            //grid.CancelEdit();

            DataSet      ds        = (DataSet)Session["DataSet"];
            ASPxGridView gridView  = (ASPxGridView)sender;
            DataTable    dataTable = ds.Tables[0];

            dataTable.PrimaryKey = new DataColumn[] { dataTable.Columns["PK"] };
            DataRow row = dataTable.Rows.Find(e.Keys["PK"]);

            row["POQty"]       = qty.Value.ToString();
            row["POCost"]      = cost.Value.ToString();
            row["POTotalCost"] = total.Value.ToString();


            IDictionaryEnumerator enumerator = e.NewValues.GetEnumerator();

            enumerator.Reset();

            while (enumerator.MoveNext())
            {
                //MRPClass.PrintString(enumerator.Key.ToString());
                row[enumerator.Key.ToString()] = enumerator.Value.ToString();
            }
            gridView.CancelEdit();
            e.Cancel = true;


            POAddEditGrid.DataSource   = dataTable;
            POAddEditGrid.KeyFieldName = "PK";
            POAddEditGrid.DataBind();
        }
Exemplo n.º 3
0
 private void BindGrid()
 {
     POAddEditGrid.DataSource   = POClass.PO_AddEdit_Table(ponumber);
     POAddEditGrid.KeyFieldName = "PK";
     POAddEditGrid.DataBind();
 }