• Using Unbound Columns [Janus GridEX WinForms Control v3.5 for .NET]

    This tutorial is intended to show how to use unbound columns in a bound GridEX control.



    Follow these steps to create a simple form using a GridEX control to display records from a table in a database with one unbound column whose values are set in the LoadingRow event.



    1 - Create a new Visual Basic or C# project using "Windows Application" Template



    2 - Add "Order Details" Table from JSNorthwind database as a Data Source for the application. After adding the table, build the application to be able to see Order_DetailsTableAdapter and JSNorthwindDataSet components in the tool box.



    3 - Add a GridEX control to Form1.



    4 - From the "Data Sources" window in the Application, drag Order_Details table and drop it into the new GridEX control. JSNorthwindDataSet, Order_DetailsTableAdapter and Orders_DetailsBindingSource components will be created.



    5 - In the Designer window of the GridEX control click on the "Retrieve Structure" button to let GridEX control create the root table and the columns matching those found in the data source.



    6 - Once the base structure is created, modify the layout as you want, changing the column positions, column widths.



    7 - To create an unbound column, follow these steps:



    8.1 - In the GridEX Designer, select Columns collection below the RootTable node and click in the Add button.



    8.2 - Select "Unbound Column" and change the Key of the new column to "Total". Click Next.



    8.3 - Select NoEdit in the EditType Combo. Click Finish.



    8.4 - Finally, in the FormatString property of the column, set "c" to see the values of the columns formatted as currency values.



    9 - The cells under an unbound column are empty by default. To set the value of a cell that belongs to an unbound column, the developer must handle the LoadingRow event and set the value in the GridEXCell object like it is done in the following code:



    In VB.Net



    If e.Row.RowType = RowType.Record Then

    e.Row.Cells("Total").Value = totalValue

    End If



    In C#.Net



    if(e.Row.RowType==RowType.Record)

    {

    e.Row.Cells["Total"].Value = totalValue;

    }





    10 - Press F5 and run the project.

    Source Of Information : Janus v3.5 Help Files for VS 2008


0 comments:

Leave a Reply