Implementing a Client Callback

You can also handle client callbacks directly, rather than having it automatically display a window at the mouse position.

In this situation the actual hover panel control is not used to display anything (unless you manually assign something to the control from your script code). To do this simply,

  • Set EventHandlerMode to CallEventHandler
  • Set the ClientEventHandler to JavaScript function you implement
  • Make sure the function takes a single string parameter

<ww:wwhoverpanel id="LineItemsPanel" style="DISPLAY:none" runat="server" 
                           NavigateDelay="500" 
                           ServerUrl="ShowInvoice.aspx" 
				     EventHandlerMode="CallEventHandler"
                           ClientEventHandler="InvoiceHovered" ></ww:wwhoverpanel>

The event hookup is the same as in the window display example.

<ItemTemplate>
 <a href='ShowInvoice.aspx?id=<%#  DataBinder.Eval(Container,"DataItem.Pk")%>' 
      onclick='<LineItemsPanel_StartCallback(event,"id=<%# DataBinder.Eval(Container,"DataItem.Pk") %>");return false;'
>
<%#  DataBinder.Eval(Container,"DataItem.InvNo") %></a>
</ItemTemplate>

Finally you need to implement your actual handler that does something with the data. Here, I'm simply going to display an alert box with the result.

<script>
function InvoiceHovered(ResultString) 
{
	alert(ResultString);
}
</script>

In addition to the ResultString you can also gain access to the XmlHttp object directly and retrieve the responseText or responseXml properties of it directly. The code to do this looks like this:

<script>
function InvoiceHovered(ResultString) 
{
	alert(LineItemsPanel_Http.responseXml);
}
</script>

Note that if you have multiple controls on a form each gets its own XmlHttp object and support functions in order to support multiple simultaneous callbacks.


© West Wind Technologies, 1996-2018 • Updated: 07/20/05
Comment or report problem with topic