Intersoft WebCombo Documentation
How-to: Add item in unbound WebCombo from client side
See Also Send comments on this topic.
Intersoft WebCombo > WebCombo Features Overview > Unbound Mode How-to Topics > How-to: Add item in unbound WebCombo from client side

Glossary Item Box

In WebCombo, you can add item from Client-side. 

This topic will show you how to add item to unbound WebCombo on Client-side.

To add item in unbound WebCombo from Client-side

  1. Drag HTML Button to the page.
  2. Add the following function in client side:

    JavaScript Copy ImageCopy Code
    function addItem()
    {
       var wc4 = ISGetObject("WebCombo1");
       var rows = wc4.GetRows(); // get the WebCombo4's rows for addition
       var newRow = wc4.NewRow("NEWCUST2"); // instantiate new row with NEWCUST as the KeyValue, containing cells with empty value
       var cells = newRow.GetCells(); // get the cells of the new row for value assignment
                                    
       // addition
       cells.GetNamedItem("ContactName").Text = "New Customer2"; // write codes in the same way as in server-side object model, with similar object hierarchy.
       cells.GetNamedItem("Address").Text = "New Address2"; // assign value to Address Cell
       cells.GetNamedItem("CustomerID").Text = "NEWCUST2";
       rows.Add(newRow); //add the newRow to the rows collection
    
       // modification
       cells = rows[1].GetCells();
       cells[0].Text = "Changed Text"; // modify the text
       rows[1].SetChanged();
                                    
       // update all changes now
       wc4.UpdateUI();
    }
                            

  3. Next, add onclick ="addItem()" on the HTML Button's tag like following:

    <input id="Button1" type="button" value="Test" onclick="addItem()" />

  4. Run the project.

See Also