How to: Use the RealTimeSearchMonitor Extender
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This topic describes how to use the RealTimeSearchMonitor control. This control allows ASP.NET developers to implement real-time search without writing custom client-side code. For more information about this control, see RealTimeSearchMonitor Control.
To use the RealTimeSearchMonitor control, you must have a Web site or Web application project that has been configured to use the ASP.NET 2.0 AJAX Extensions.
The Web page that you want to add real-time search capabilities to must have at least one search input control and must contain an UpdatePanel control where the search results are displayed.
The following procedure describes how to use the RealTimeSearchMonitor control to add real-time search capabilities to a search form.
To use the control
- In your Web site, add a reference to the RealTimeSearch.dll assembly.
- Add the RealTimeSearchMonitor control to the Toolbox (this step is necessary only if you do not see the RealTimeSearchMonitor control in the Toolbox). To add the RealTimeSearchMonitor control to the Toolbox, right-click the Toolbox, and then click Choose Items. On the .NET Framework Components tab, click Browse, select the RealTimeSearch.dll assembly, and then click Open. In the list of components, select the RealTimeSearchMonitor control, and then click OK.
- Drag a RealTimeSearchMonitor control to the Web page to which you want to add real-time search capabilities.
- Open the Properties window for the control, as shown in Figure 1.
- Enter the ID of the UpdatePanel control where the search results are displayed in the AssociatedUpdatePanelID property.
- Click the ellipsis in the ControlsToMonitor property to open the collection editor, as shown in Figure 2.
- For each input control that you want to be monitored, click Add and set the following properties:
Properties window for the RealTimeSearchMonitor control
Collection editor for the ControlsToMonitor property
- TargetId. This is the ID of the input control to be monitored
- (Optional) EventName. This is the name of the event of the input control that triggers an update in the associated UpdatePanel control. If no value is specified for this property, the default event of the control will trigger the update.
|The RealTimeSearchMonitor control adds an AsyncPostBackTrigger to the associated UpdatePanel control at run time for each monitored control. The EventName property of the AsyncPostBackTrigger is set with the value you enter in the EventName property of the control to monitor.|
The following code extracted from the Real-Time Search QuickStart shows the markup of a fully configured RealTimeSearchMonitor control.
<rts:RealTimeSearchMonitor ID="CustomerRealTimeSearchMonitor" runat="server" Interval="700" AssociatedUpdatePanelID="ResultsUpdatePanel"> <ControlsToMonitor> <rts:ControlMonitorParameter TargetId="CompanyNameTextBox" /> <rts:ControlMonitorParameter TargetId="CityTextBox" /> <rts:ControlMonitorParameter TargetId="StateDropDown" /> <rts:ControlMonitorParameter TargetId="ZipCodeTextBox" /> </ControlsToMonitor> </rts:RealTimeSearchMonitor>
|Typically, you subscribe to the TextChanged event of TextBox controls.|
|The RealTimeSearchMonitor control invokes the validators of the monitored controls before performing an asynchronous postback. If the validation fails for any of the input controls, the postback is not done.|