Compartir a través de


GrammarTemplate Property for French (Canada)

  Microsoft Speech Technologies Homepage

Gets or sets the name of a grammar template that is used to load the recognition grammar. Read/write.

Usage

ASP.NET markup: <speech:ListSelector GrammarTemplate="..." />
Get value: ITemplate = ListSelector.GrammarTemplate;
Set value: ListSelector.GrammarTemplate = ITemplate;
Data type: ITemplate
Required: No; Default: Null

Remarks

Each call to the template must return a pipe-delimited string of terms. Each term is a possible way of saying the value. Calls are made with the data obtained from the source. To set this property in the UI, right-click the ListSelector control, select Edit Template, select Grammar Template, and enter the name of a grammar template.

Example

In the following example, the Grammar Template property contains three pipe-delimited terms, which enable the user to select an employee by first name, by last name or by first and last names, respectively.

<form id="Form1" method="post" runat="server">
  ...
  <speech:semanticmap ID="SemanticMap1" runat="server">
      <speech:SemanticItem ID="SemanticItem1" runat="server" >
      </speech:SemanticItem>
  </speech:semanticmap>

  <speech:ListSelector ID=ListSelector1 runat="server"
    SemanticItem="SemanticItem1" 
    QuestionPrompt="a quel employé voulez-vous parler?"  
    DataSource="<%# CorpData %>"
    DataMember="Employee" 
    DataTextField="LastName" 
    DataBindField="PhoneExt" 
    <GrammarTemplate>
        <%# DataBinder.Eval(Container.DataItem, "FirstName") %>
        | 
        <%# DataBinder.Eval(Container.DataItem, "LastName") %>
        | 
        <%# DataBinder.Eval(Container.DataItem, "FirstName") %> 
        <%# DataBinder.Eval(Container.DataItem, "LastName") %>
    </GrammarTemplate>
    FirstInitialTimeout="0">
  </speech:ListSelector>
  ...
</form>

See Also

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