Compartir a través de


Text Property

  Microsoft Speech Technologies Homepage

Gets the text value of the SemanticItem control that caused the postback event. Read-only.

Usage

ASP.NET markup: <speech:SemanticEventArgs Text="..." />
Get value: String = SemanticEventArgs.Text;
Set value: Read-only
Data type: String

Remarks

This property contains the value property of the client-side SemanticItem object that caused the postback event.

Example

In the following example, the Application Speech Control collects a credit card type and a credit card number. When the CreditCardNumber control has completed successfully, the credit card type is placed in the Attributes property of the CreditCardNumber control's SemanticItem, and the credit card number is placed in the tbClientNum textbox.

Because the AutoPostBack property of the SemanticItem is true, the binding process raises a server-side SemanticEvent and passes a SemanticEventArgs object to the event-handling routine. The OnServerConfirmed routine extracts the credit card number from the SemanticEventArgs.Text property and the credit card type from the SemanticEventArgs.Attributes property, and displays them in the tbServerNum and tbServerTyp textboxes, respectively.

<script language="C#" runat="server">

  void OnServerConfirmed(Object sender, Microsoft.Speech.Web.UI.SemanticEventArgs e)
  {
    string cnum=e.Text;
    string ctyp=e.Attributes["cardType"];
    tbServerNum.Text=cnum;
    tbServerTyp.Text=ctyp;
  }
  
</script>
  
<form id="Form1" method="post" runat="server">
  ...
  <speech:SemanticMap ID="SemanticMap" runat="server">
    <speech:SemanticItem ID="card" 
      AutoPostBack="true" 
      BindOnChanged="false" 
      TargetElement="tbCard" 
      TargetAttribute="value" 
      OnConfirmed="OnServerConfirmed" 
      runat="server" />
  </speech:SemanticMap>
  
  <asp:TextBox ID="tbClientNum" Runat="server"></asp:TextBox><br/>
  <asp:TextBox ID="tbServerNum" Runat="server"></asp:TextBox><br/>
  <asp:TextBox ID="tbServerTyp" 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="card"
    runat="server">
  </speech:CreditCardNumber>
  ...
</form>

See Also

SemanticEventArgs Class | SemanticEventArgs Constructor | SemanticEventArgs Members | SemanticEventArgs Properties | SemanticEventArgs Methods