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
- Drag WebCombo instance to the page.
- Right-click on the WebCombo instance and select WebCombo Designer.
- Set AllowAddItem to True in Advanced Settings - Layoutsettings.
- Drag AccessDataSource control to the page.
- Click the AccessDataSource instance and press F4.
- Set EnableCaching to True from the properties
box.
- On the WebCombo's AddItem event handler, put the following
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);
}
|
- Run the project.