Overview
In this document, we will learn to create a “Dynamic Grid” control under the page. This option allow us to generate multiple columns in a grid without the need to create “Grid Column” controls for each column that you want to display on the page. This is an easy way to make an association between the tables or stored procedures previously generated in DB to print the registers in the project’s application.
How to create a Stored Procedure and a new Dataset for “Dynamic Grid” control ?
As precondition to create a “Dynamic Grid” control, we need to connect to the DB in SQL and create a new Stored Procedure like we did in other examples.
Open a new query and create a procedure with 3 columns “Description”, “Latitude” and “Longitude”:
After execution is done, turn to Wayfast and select any page from the project.
Focus on “Dataset” section
Notice that there’s no element associated to the page. Click “New Dataset” button to create a new one that will contain the information from the Stored Procedure.
Complete the “General” tab with the basic information to identify the dataset. Turn to “Data Binding” tab
Select the “Stored Procedure” type and look for the one created in SQL for this purpose. Once the “Instance” match with the one used in DB to create the procedure, we can establish the proper relationship in Wayfast. Click “Accept” button save the changes.
If we edit the dataset and focus on “Columns” tab, you can observe that the same 3 columns are generated automatically in Wayfast at Dataset:
How to create a “Dynamic Grid” control?
Now that we generated the preconditions, we can easily create the “Dynamic Grid” control by selecting the control and click “New” button in the same page that we worked on.
A popup is displayed to complete the details on “Dynamic Grid” control. Make sure that the control is properly identified at “General” tab. Then click “Data Binding” tab
Since we created a dataset on this page, we will see the option displayed in the dropdown list. This reference will link the stored procedure data, the dataset and finally the control itself.
Include the “Layout” information and click “Accept” to complete the process
Setup is completed. Let’s click on “Preview” button to verify that the “Dynamic Grid” control is showing all the columns and data retrieved from the stored procedure.
Recap
This control give us the possibility to create a grid in our pages, by just connecting the stored procedure, no need to create multiple “Grid Column” controls for each column in grid.
At this point, we make a big progress in Wayfast learning path, the basic controls that we have learned in the beginning give way to new and more complex controls that allow to collect the information and display it on the pages in a simpler way.