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
- Drag HTML Button to the page.
- Add the following function in client side:
JavaScript Copy 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(); }
- Next, add onclick ="addItem()" on the HTML Button's tag like following:
<input id="Button1" type="button" value="Test" onclick="addItem()" />
- Run the project.