Text Property
Gets or sets the text value of the SemanticItem control. Read/write.
Usage
ASP.NET markup: | <speech:SemanticItem Text="..." /> |
Get value: | String = SemanticItem.Text; |
Set value: | SemanticItem.Text = String; |
Data type: | String |
Required: | No |
Remarks
The Text property of the SemanticItem control is the server-side equivalent of the value property of the SemanticItem client object.
Example
In the following example, a Application Speech Control collects a credit card type and a credit card number. It places the credit card number in its target SemanticItem and places the credit card type in the cardType attribute of the SemanticItem. The OnServerEvent routine handles both the Changed and the Confirmed events. This routine displays the credit card number, the credit card type and the semantic state of the SemanticItem whenever the card number is changed or confirmed.
<form id="Form1" method="post" runat="server">
...
<script language="C#" runat="server">
void OnServerEvent(Object sender, Microsoft.Speech.Web.UI.SemanticEventArgs e)
{
tbServerCCNum.Text=siCCard.Text;
tbServerCCTyp.Text=siCCard.Attributes["cardType"];
if (siCCard.State==SemanticState.Empty) tbState.Text="Empty";
if (siCCard.State==SemanticState.NeedsConfirmation) tbState.Text="NeedsConfirmation";
if (siCCard.State==SemanticState.Confirmed) tbState.Text="Confirmed";
}
</script>
...
<speech:SemanticMap ID="SemanticMap" runat="server">
<speech:SemanticItem
ID="siCCard" runat="server"
OnConfirmed="OnServerEvent"
OnChanged="OnServerEvent"
TargetAttribute="value"
TargetElement="tbClientCCNum"
BindOnChanged="false"
AutoPostBack="true"></speech:SemanticItem>
</speech:SemanticMap>
<asp:label runat="server">CC number (client)</asp:Label>
<asp:TextBox ID="tbClientCCNum" Runat="server"></asp:TextBox><br>
<asp:label runat="server">CC number (server)</asp:Label>
<asp:TextBox ID="tbServerCCNum" Runat="server"></asp:TextBox><br>
<asp:label runat="server">CC type (server)</asp:Label>
<asp:TextBox ID="tbServerCCTyp" Runat="server"></asp:TextBox><br>
<asp:label runat="server">Semantic State (server)</asp:Label>
<asp:TextBox ID="tbState" Runat="server"></asp:TextBox>
<speech:AnswerCall SpeechIndex="10" ID="AnswerCall1" runat="server">
</speech:AnswerCall>
<speech:CreditCardNumber
SpeechIndex="20"
QuestionPrompt="Please say your credit card number"
AllowAmex="true"
AllowDinersClub="true"
AllowDiscover="true"
AllowMasterCard="true"
SemanticItem="siCCard"
runat="server" ID="Creditcardnumber1">
</speech:CreditCardNumber>
...
</form>
See Also
SemanticItem Class | SemanticItem Constructor | SemanticItem Members | SemanticItem Properties | SemanticItem Methods | SemanticItem Events | SemanticItem Remarks | SemanticItem Client Object