WebCombo's client binding technology provides not only advanced features and engaging UX, but also well-designed architecture to enable greater control over data service processing.
Client data services support the following events:
- Selecting. Invoked when the data provider is about to perform data selection.
- Selected. Invoked after the data provider has successfully selecting data.
- Updating. Invoked when the data provider is about to perform data update.
- Updated. Invoked after the data provider has successfully updating data.
- Inserting. Invoked when the data provider is about to perform data insert.
- Inserted. Invoked after the data provider has successfully inserting data.
- Deleting. Invoked when the data provider is about to perform data delete.
- Deleted. Invoked after the data provider has successfully deleting data.
- BatchUpdating. Invoked when the data provider is about to perform batch update
- BatchUpdated. Invoked after the data provider has successfully perform batch update.
This topic shows how to handle Data Service Events.
To handle Data Service Events
- Create a Javascript function in the client-side to be used in ServiceEvents.
Javascript Copy Code var logCount = 0; function LogEvent(text) { var dvLog = document.getElementById("dvLog"); dvLog.innerHTML += "" + text + ""; dvLog.scrollTop = dvLog.scrollHeight; logCount++; } function Service_Selecting(control, selectArguments) { LogEvent("Selecting data. Operation Type: " + selectArguments.OperationType + ", FilterExpression=" + selectArguments.FilterExpression + ", SortExpression=" + selectArguments.SortExpression); } function Service_Selected(control, result) { var resultText = ""; if (typeof (result) == "number") resultText = "Total record count = " + result; else resultText = result.Results.length + " records retrieved"; LogEvent("Data selected - " + resultText); }
Service_Selecting function is used in Selecting event, whereas Service_Selected is used in Selected event. - In ClientBindingSettings property, there are several events provided in Service Events. The following code is used to apply the Selecting and Selected events along with the function created before.
Property Value BindingOperationMode ClientBinding DataSourceType WebService ServiceUrl WebCombo_WebService.asmx (or any .asmx file created by user) Selecting Service_Selecting Selected Service_Selected
HTML Copy Code <ISWebCombo:WebCombo ID="WebCombo1" runat="server" DataTextField="ContactName" DataValueField="CustomerID" Height="20px" UseDefaultStyle="True" Width="200px" BindingOperationMode="ClientBinding"> <ClientBindingSettings DataSourceType="WebService" ServiceUrl="WebCombo_WebService.asmx"> <ServiceMethods SelectMethod="GetCustomers" /> <ServiceEvents Selecting="Service_Selecting" Selected="Service_Selected" /> </ClientBindingSettings> </ISWebCombo:WebCombo>