Intersoft Support Center

Allow Add New Item

In WebCombo, you are able to add new item in WebCombo.

This topic will show you how to Add Item in bound WebCombo.

To add Item in bound WebCombo

  1. Drag WebCombo instance to the page.
  2. Right-click on the WebCombo instance and select WebCombo Designer.
  3. Set AllowAddItem to True in Advanced Settings - Layoutsettings.
  4. Drag AccessDataSource control to the page.
  5. Click the AccessDataSource instance and press F4.
  6. Set EnableCaching to True from the properties box.
  7. On the WebCombo's AddItem event handler, put the following code :

    C# Copy ImageCopy Code
    protected void WebCombo1_AddItem(object sender, ISNet.WebUI.WebCombo.RowEventArgs e)
    {        
       // get cached data from data source control        
       DataView view = this.EmployeeDataSource.Select(DataSourceSelectArguments.Empty) as DataView;        
    
       // update the cached data
       DataTable table = view.Table;
       DataRow newRow = table.NewRow();
       newRow["FirstName"] = e.Row.Value;
       table.Rows.Add(newRow);
    }
    

  8. Run the project.
Previous Next