Month: October 2013

Method to write logic when Default Insert button clicked in EP

Hi,

As we know in EP, insert and edit button will be generated automatically from the Ax form properties in C# design. Here is the requirement where i need to do some more process after the insertion.

Below is the sample code  :

//Insert code for CBL
public void formPersonalContactEdit_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
//check if insert is successful, then close dialog
if (e.AffectedRows == 1)
{
string totalseelcted = this.Category1.Text;

}

call the method in init()

protected void Page_init(object sender, EventArgs e)
{
this.AxForm2.ItemInserted += new DetailsViewInsertedEventHandler(formPersonalContactEdit_ItemInserted);
}

Advertisements

Passing values between URL in EP

Hi,

Below code used in C# to pass the values between EP pages.

From A button click :

Response.Redirect(“URL?EmplId=” + EmplId);

Form B init : capture the passed record in c# page init method

protected void Page_init(object sender, EventArgs e)
{
_emplId = Request.QueryString[“EmplId”];
Proxy.Info objInfoLog = new Proxy.Info(this.AxSession.AxaptaAdapter);
objInfoLog.add(Proxy.Exception.Error, Emplid);

}

Passing the captured value back to the Data set which is used by form B :

protected void Page_init(object sender, EventArgs e)
{
this.AxDataSource1.CreatingDataSetRun += new EventHandler<CreatingDataSetRunEventArgs>(AxDataSource1_CreatingDataSetRun);
}

void AxDataSource1_CreatingDataSetRun(object sender, CreatingDataSetRunEventArgs e)
{
string parm;
e.DataSetRunArgs.parm = _emplId;
}