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
- Set AllowAddItem in WebCombo.
- 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 :
C# Copy 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.
Tasks
How-to: Add item in unbound WebCombo from server side
How-to: Add item in unbound WebCombo from client side
How-to: Use OnAddItem client side event to validate input
FAQ: How to implement adding item in WebCombo when we set AllowAutoPostBack and AllowAddItem to true?
Concepts
Dynamically Add Item
References
AddItem Event