DataTableNavigator.GrammarTemplate Property
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Gets or sets the name of a grammar template that is used to load the recognition grammar. Read/write.
Namespace: Microsoft.Speech.Web.UI
Assembly: Microsoft.Speech.Web (in microsoft.speech.web.dll)
Syntax
'Declaration
<DefaultValueAttribute(Nothing)> _
<PersistenceModeAttribute(PersistenceMode.InnerProperty)> _
<TemplateContainerAttribute(GetType(DataItemContainer))> _
<BrowsableAttribute(False)> _
Public Property GrammarTemplate As ITemplate
[DefaultValueAttribute(null)]
[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
[TemplateContainerAttribute(typeof(DataItemContainer))]
[BrowsableAttribute(false)]
public ITemplate GrammarTemplate { get; set; }
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, right-click the DataTableNavigator control, click Edit Template, click Grammar Template, and then enter the name of a grammar template.
Example
In the following example, the GrammarTemplate 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="weather by state"
DataHeaderFields="city,state"
DataContentFields="low,high,conditions"
<GrammarTemplate>
{OPEN_ASP_TAG}# DataBinder.Eval(Container.DataItem, "CityName") {CLOSE_ASP_TAG}
|
{OPEN_ASP_TAG}# DataBinder.Eval(Container.DataItem, "CityName") {CLOSE_ASP_TAG}
{OPEN_ASP_TAG}# DataBinder.Eval(Container.DataItem, "StateName") {CLOSE_ASP_TAG}
</GrammarTemplate>
EndSilence="2500"
AccessMode="Select"
ShortInitialTimeout="2000"
SemanticItem="SemItemNav"
runat="server">
</speech:DataTableNavigator>
...
</form>
Thread Safety
All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.
Platforms
Development Platforms
Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition
Target Platforms
Windows Server 2003
See Also
Reference
DataTableNavigator Class
DataTableNavigator Members
Microsoft.Speech.Web.UI Namespace