Partilhar via


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:DataTableNavigator GrammarTemplate="..." />
Get value: ITemplate = DataTableNavigator.GrammarTemplate;
Set value: DataTableNavigator.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 DataTableNavigator 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 two pipe-delimited terms, which enable the user to select a city by city name or by city and state names, respectively.

<form id="Form1" method="post" runat="server">
  ...
    <asp:textbox id="TextBox1" runat="server"></asp:textbox>
    <speech:semanticmap id="SemanticMap1" runat="server" >
      <speech:SemanticItem id="SemItemNav" runat="server" 
        TargetElement="TextBox1" TargetAttribute="value" BindOnChanged="True">
      </speech:SemanticItem>
    </speech:semanticmap>

    <speech:DataTableNavigator 
      id="Navigator1"  
      QuestionPrompt="météo par état" 
      DataHeaderFields="ville,état"
      DataContentFields="minimum,maximum,conditions" 
      <GrammarTemplate>
          <%# DataBinder.Eval(Container.DataItem, "CityName") %>
          | 
          <%# DataBinder.Eval(Container.DataItem, "CityName") %> 
          <%# DataBinder.Eval(Container.DataItem, "StateName") %>
      </GrammarTemplate>
      EndSilence="2500" 
      AccessMode="Select" 
      ShortInitialTimeout="2000" 
      SemanticItem="SemItemNav"
      runat="server">
    </speech:DataTableNavigator>
  ...
</form>

See Also

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