Partilhar via


TargetElement Property

  Microsoft Speech Technologies Homepage

Gets or sets the server-side ID of the input control to which the value of the SemanticItem control binds. Read/write.

Usage

ASP.NET markup: <speech:SemanticItem TargetElement="..." />
Get value: String = SemanticItem.TargetElement;
Set value: SemanticItem.TargetElement = String;
Data type: String
Required: No; Default: Null

Remarks

The TargetElement property is used together with the TargetAttribute property. The control throws the ArgumentNullException if TargetElement is specified and TargetAttribute is not specified.

Example

<form runat=server>
  ...
  <asp:label runat=server>Beverage Type: </asp:label>
  <asp:textbox id="txtBeverage" runat=server></asp:textbox><br />
  <asp:label runat=server>Number of shots: </asp:label>
  <asp:textbox id="txtShots" runat=server></asp:textbox><br />
  <asp:label runat=server>Temperature: </asp:label>
  <asp:textbox id="txtTemp" runat=server></asp:textbox><br />
  <asp:label runat=server>Container Size: </asp:label>
  <asp:textbox id="txtSize" runat=server></asp:textbox><br />
  ...
  <Speech:SemanticMap id="TheSemanticMap" runat="server">

    <Speech:SemanticItem id="siDrink" runat="server"
      TargetElement="txtBeverage" TargetAttribute="value" >
    </Speech:SemanticItem>

    <Speech:SemanticItem id="siShots" runat="server"
      TargetElement="txtShots" TargetAttribute="value" >
    </Speech:SemanticItem>

    <Speech:SemanticItem id="siTemp"  runat="server"
      TargetElement="txtTemp" TargetAttribute="value" >
    </Speech:SemanticItem>

    <Speech:SemanticItem id="siSize"  runat="server"
      TargetElement="txtSize" TargetAttribute="value" >
    </Speech:SemanticItem>

  </Speech:SemanticMap>
  ...
  <Speech:QA runat=server>
    <Prompt inlinePrompt="What kind of coffee would you like?" />
    <Reco Reject=".5" InitialTimeout="3000" BabbleTimeout="10000" EndSilence="1000" MaxTimeout="30000">
      <Grammars>
        <speech:Grammar src="Grammars\caffe.xml" />
      </Grammars>
    </Reco>
    <Answers>
      <speech:Answer XPathTrigger="/SML/TYPE"        SemanticItem="siDrink" />
      <speech:Answer XPathTrigger="/SML/SHOTS"       SemanticItem="siShots" />
      <speech:Answer XPathTrigger="/SML/TEMPERATURE" SemanticItem="siTemp" />
      <speech:Answer XPathTrigger="/SML/SIZE"        SemanticItem="siSize" />
    </Answers>
  </Speech:QA>
  ...
</form>

See Also

SemanticItem Class | SemanticItem Constructor | SemanticItem Members | SemanticItem Properties | SemanticItem Methods | SemanticItem Events | SemanticItem Remarks | SemanticItem Client Object