Monthly Archives: November 2013

Enable / Disable controls in an Asp.Net Panel C#

If there are Panel controls in the page then a mere iteration with the Page.Controls collection will not reflect the controls which are placed inside the Panel, to Enable/Disable controls in the Panel, we need to iterate throught the Controls in the Panel.

Enable / Disable all controls in an Asp.Net Page in C#

In general for Asp.Net forms we maintain different modes like Create mode, View mode & Edit mode.
In the View mode we will disable all the controls to make sure that the user does not, modify any of the details.

If the form is small then we can manually set the .Enabled property to false for all the controls in the form to achieve the effect, however if we have a huge form with hundreds of controls then this becomes a tedious task to set the property for each of the controls, in these scenarios we can make use of the Page.Controls collection to loop throught all the controls in the page and Enable/Disable the controls.

Error when generating CIL on AX 2012

When you run a Full CIL or an Incremental CIL and the system returns this error:

CIL generation: The given key was not present in the dictionary

You must navigate this path: C:Program FilesMicrosoft Dynamics AX60Server<AOS ISTANCE NAME>binXppIL

and open the file: Dynamics.Ax.Application.dll.log

here you can see error like this:

Finished pass 1 at 28/10/2013 09:12:55
Error when loading the method. Type: TaxSalesShippingBill_IN, Method: new
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary

Now you must correct all exceptions and recompile the objects

Executing SQL statements from X++

Example #1: Retrieve data:

Example #2: Edit data (delete):

How to get day month year from date in AX X++

Get field label in X++

With this little example we can get the Label assigned to Field Table

Change the table properties by using X++ code

How to get current company in Axapta AX 2012

You can get, in AX 2012, the current company using this code:

How to get current company in Axapta AX 2009

You can get, in AX 2009, the current company using this code:

Count Records in Query in AX 2009 / 2012

Whith the following code you can retive the count of rows selected by Query Object