OnClientError Property
Gets or sets the name of the client-side event handler for the onerror event. Read/write.
Usage
ASP.NET markup: | <speech:Prompt OnClientError="..." /> |
Get value: | String = Prompt.OnClientError; |
Set value: | Prompt.OnClientError = String; |
Data type: | String |
Required: | No; Default: String.Empty |
Remarks
The script block that contains the event handler function should be placed before the control that calls the function. For more information, see "Placement of Script Blocks" in Authoring Notes
Example
The following example demonstrates a simple error-handling routine for the OnClientError property.
<script>
//
// Handle error and keep going
//
function myErrorHandler {
return true;
}
//
// Change textbox color
//
function myRedText() {
document.all('txtDest').style.backgroundColor = 'red';
return true;
}
</script>
<form id="Form1" method="post" runat="server">
...
<asp:label runat=server>Destination City: </asp:label>
<asp:textbox id="txtDest" runat=server></asp:textbox>
<speech:Prompt
ID="Prompt1" runat="server"
AutoPostBack="True"
PreFetch="True"
BargeIn="True"
OnClientError="myErrorHandler"
Lang="en-US">
<Params>
<speech:Param Name="BargeInType">final</speech:Param>
</Params>
<InlineContent> What is your destination city? </InlineContent>
</speech:Prompt>
<speech:Listen id="Listen1" runat="server"
BabbleTimeout="2000" MaxTimeout="5000" Reject="0.2">
<bindings>
<speech:bind TargetElement="txtDest" TargetAttribute="value"
value="./City" runat="server"/>
</bindings>
<grammars>
<speech:grammar runat="server"
src="Grammars/CityGrammar.grxml" ID="Grammar1" />
</grammars>
</speech:Listen>
...
</form>
See Also
Prompt Class | Prompt Constructor | Prompt Members | Prompt Properties | Prompt Methods | Prompt Events | Prompt Remarks