Hi Guys,
Today i would like to share you , how to create/insert new line
in AXGridView in EP
Step 1:
Add a Button called Add line
Step 2:
write this below code
using Microsoft.Dynamics.AX.Framework.Portal.Data;
protected void NewLine_Click(object sender, EventArgs e)
{
int editIdx = AxGridView1.EditIndex;
try
{
// Save the last unsaved line if any
if (AxGridView1.EditIndex != -1 && AxGridView1.Rows.Count > 0)
{
this.AxGridView1.UpdateRow(AxGridView1.EditIndex, true);
}
DataSetViewRow dsvr = this.dsv.AddNew();
}
catch (System.Exception ex)
{
AxExceptionCategory exceptionCategory;
if (!AxControlExceptionHandler.TryHandleException(this, ex, out
exceptionCategory))
{
// Throw the fatal exception
throw;
}
if (exceptionCategory == AxExceptionCategory.NonFatal)
{
AxGridView1.EditIndex = editIdx;
}
}
}
private DataSetView dsv //get dataset view
{
get
{
DataSet dataSet = this.AxDataSource1.GetDataSet();
return dataSet.DataSetViews[this.AxGridView1.DataMember];
}
}
Step 3: Go to properties-> Events->Click, select NewLine_click
Step 4:
Build and deploy the visual studio project
That's it we have done it ........
Thanks & Regards,
BanuPriya.S
can you let me know How to do the "Add Lines" functionality for salesOrder in EP Ax2012?
ReplyDelete