Domanda

I need to make a completely new row in specified Dataset in Dynamics AX Enterprise Portal User Control (without editing this data in axgridview). I've developed code as follows:

CodeBehind:

protedted void NewDelegAxPopupParentControl_PopupClosed(object sender, EventArgs e)
{

    DataSet dataSet = this.AxDataSource.GetDataSet();
    DataSetView dataSetView = dataSet.DataSetViews[this.AxGridView1.DataMember];
    DataSetViewRow dataSetViewRow = dataSetView.AddNew();

    dataSetViewRow.SetFieldValue("ProjId", projid);
    dataSetViewRow.SetFieldValue("Destination_ITG", location);
    dataSetViewRow.SetFieldValue("DateFrom_ITG", DateTime.ParseExact(datefrom, "yyyy-MM-dd", CultureInfo.InvariantCulture));
    dataSetViewRow.SetFieldValue("DateTo_ITG", DateTime.ParseExact(dateto, "yyyy-MM-dd", CultureInfo.InvariantCulture));
    dataSetViewRow.SetFieldValue("Employee", "102");

    dataSetViewRow.EndEdit();
}

When i first time add new row to dataset - it works fine. When i want to add another row - instead of creating new - it updates previous one.

Any help in resolving this issue will be very appreciated.

È stato utile?

Soluzione

You might be able to bypass the problem by letting AX do the creation.

This is listed as the number 3 solution in The Code Workshop.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top