Partilhar via


Src Property

  Microsoft Speech Technologies Homepage

Gets or sets the URI of a grammar to load. Read/write.

Usage

ASP.NET markup: <speech:Grammar Src="..." />
Get value: String = Grammar.Src;
Set value: Grammar.Src = String;
Data type: String
Required: Yes

Remarks

When creating a Grammar control, it is the author's responsibility to specify a single grammar resource, either inline or referenced. Behavior of a Grammar that specifies more than one, or less than one grammar resource, is undefined.

The Src property mirrors the src property on the SALT grammar object.

Example

The following example demonstrates a Command control that contains a single Grammar control, and a QA control that contains two Grammar controls in a Grammars collection.

<form id="Form1" method="post" runat="server">
  ...
  <asp:panel id="CalendarPanel" runat="server"> 

    <speech:command id="CmdHelp" runat="server" scope="AskDateQA" type="Help" XPathTrigger="/SML/Command/Help">
      <grammar id="GlobalCmdHelp" runat="server" src="Grammars/GlobalCommandHelp.grxml" />
    </speech:command>
    
    <speech:customvalidator id="ValidateQA" runat="server" clientvalidationfunction="Date_Validator" validationevent="onchange"
      semanticitemtovalidate="siDate">
      <Prompt PromptSelectFunction="SayInvalidDate_PromptFunction" BargeIn="False" ID="SayInvalidDate"></Prompt>
    </speech:customvalidator>
    
    <speech:qa id="AskDateQA" runat="server">
      <Prompt PromptSelectFunction="AskDate_PromptFunction" ID="AskDate">
        <Params>
          <speech:Param Name="bargeintype">grammar</speech:Param>
        </Params>
      </Prompt>
      <Answers>
        <speech:Answer ClientNormalizationFunction="Date_Normalize" SemanticItem="siDate" ID="SayDate"
          XPathTrigger="/SML/Date"></speech:Answer>
      </Answers>
      <Reco InitialTimeout="3000" BabbleTimeout="10000" EndSilence="1000" MaxTimeout="30000"
        ID="recDay">
        <Grammars>
          <speech:Grammar Src="Grammars/DateGrammar.grxml" ID="DateGram"></speech:Grammar>
        </Grammars>
      </Reco>
    </speech:qa>

  </asp:panel>
  ...
</form>

See Also

Grammar Class | Grammar Constructor | Grammar Members | Grammar Properties | Grammar Methods | Grammar Events | Grammar Remarks