Navigation: DbNetComboCore >

Methods

 

 

 

 

AddLinkedControl(DbNetSuiteCore)

 

This method takes an instance of DbNetSuiteCore as a parameter and makes it a child of the combo on which the method is called. The parameter instance can be either another instance of DbNetComboCore or and instance of DbNetGridCore. If it is an instance of DbNetComboCore then you will need to specify the ForeignKeyColumn property or set the ForeignKey column property if it is an instance of DbNetGridCore.

 

...

DbNetGridCore employeesGrid = new DbNetGridCore("northwind", "employees join employeeterritories on employees.employeeid = employeeterritories.employeeid", "employees") { View = true };

...

employeesGrid.Bind(EventType.OnViewRecordSelected, "updateTitle");

employeesGrid.Column("TerritoryId").ForeignKey().GroupHeader().Lookup(new Lookup("territories", "TerritoryId", "territorydescription"));

...

DbNetComboCore territoriesCombo = new DbNetComboCore("northwind", "territories", "territoryid", "territorydescription", "territories") { ForeignKeyColumn = "regionid", Size = 10, MultipleSelect = true, AutoRowSelect = true };

DbNetComboCore regionsCombo = new DbNetComboCore("northwind", "regions", "regionid", "regiondescription", "regions") { Size = 10, MultipleSelect = true, AutoRowSelect = true };

territoriesCombo.AddLinkedControl(employeesGrid);

regionsCombo.AddLinkedControl(territoriesCombo);

@regionsCombo.Render()

...

 

Demo

 

Bind(EventType, string)

 

This method assigns a client-side JavaScript method to a client-side grid event which enables additonal levels of customisation. The method is passed 2 arguments. The first is the type of the event and the second is the name of the JavaScript function that will be called by the event. The JavaScript function is always passed an instance of the client-side grid control and an optional second argument that contains additional information specific to the type of event. For more information about each event type click here

 

...

DbNetComboCore customersCombo = new DbNetComboCore("northwind", "customers", "customerid", "companyname");

customersCombo.Bind(EventType.OnOptionSelected, "showSelectedCustomer");

@customersCombo.Render()

...
<script type="text/javascript">

    function showSelectedCustomer(control, args) {

        $("#selectedCustomer").html(`Selected Customer: <b>${args.selectedValues[0]}</b>`)

    }

</script>

...

 

Demo

 

Render()

 

This method is called after the component has been fully configured and will render the grid at the point in the Razor page at which it is invoked unless the optional 5th Id parameter is supplied to the constructor in which case the grid will be rendered inside the HTML element with the Id specified.

 

 

 

Copyright © 2023 DbNetLink