Friday, February 1, 2013

Using Web Services to load data in a web page (Grid Format)


The article describes the steps involved in integrating NAV with web services and to view data in a grid.

The example given below will help us to display the sales lines in a grid for a particular order. i.e. on selecting the Sale order the corresponding order details will be loaded and shown.

Steps involved:

1.       Working with Navision

a.       Go to AdministrationàIT AdministrationàGeneral Setupà Web services

b.      Publish page 42 with the Service Name “WS_SalesOrder” and Page 46 with the ServiceName “WS_SalesLine”.


 

2.       Working with .Net

a.       Create a New Asp.Net Web application project.

b.      Design the web page with dropdown list, Grid view and a Button.

c.       The drop down list box will be loaded with all the sales order available in the NAV.

d.      Select any sale order and click the “Get Sales Order” button to load the grid with sales lines for the corresponding sales order and will display the “Sell-to Customer” ID in the text box.

e.      In the Solution explorer create a Web Reference for the pages we have published in Navision.

f.        Here, “SalesOrder” as the web reference for the Page 42. (“WS_SalesOrder”) and “OrderSalesLine” as the web reference for the Page 46. (“WS_SalesLine”).

Note: The image below is the basic design of the screen.


 
                    g.       Type the following code in the Page_Load() function


h.      Type the following code in the Button Click Event


i.         Save, Build and Run the Project.

j.        On successful execution, an output (similar to the one below) must appear


 

k.       By default the grid will display all the fields that are originally available in the Navision page. Now, we can also hide the fields that we don’t want to get displayed.

Note: the section of code below shows you the option of disabling the columns that are not required



With this we now can visualize on how NAV data can be pulled out using webservices and making it to appear in a web application, with this concept we can develop more concepts where NAV data can be used with external applications.

 

Hope the information will help!!!!!!!!!!!!!!!!!

 

1 comment:

  1. Very Useful content ..... It has solved my issue.... very quickly.........

    ReplyDelete