Insert Cash Snippet

Here is another one I created. Very much like the one for the date picker except this one is for money.

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>SnippetFile1</Title>
      <Author>SheldonS</Author>
      <Description>Inserts controls with validators to enter cash amount into a textbox.</Description>
      <HelpUrl>
      </HelpUrl>
      <Shortcut>ssic</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>txtCash</ID>
          <ToolTip>ID of the asp:TextBox control that will hold the cash value.</ToolTip>
          <Default>txtCash</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>valrCash</ID>
          <ToolTip>IDof the RequiredFieldValidator control.</ToolTip>
          <Default>valrCash</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>vaeRCash</ID>
          <ToolTip>ID of the AjaxControlToolkit ValidatorCalloutExtender control for the required field validator.</ToolTip>
          <Default>vaeRCash</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>valxCash</ID>
          <ToolTip>ID of the RegularExpressionValidator control.</ToolTip>
          <Default>valxCash</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>vceXCash</ID>
          <ToolTip>IDof the AjaxControlToolkit ValidatorCalloutExntender control for the regular expression validator.</ToolTip>
          <Default>vceXCash</Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="csharp"><![CDATA[<asp:TextBox ID="$txtCash$" runat="server" Width="50px" />
<asp:RequiredFieldValidator ID="$valrCash$" runat="server" ControlToValidate="$txtCash$" 
    Text="*" ErrorMessage="You must provide the Amount." SetFocusOnError="true" 
    Display="Dynamic">
</asp:RequiredFieldValidator>
<cc1:ValidatorCalloutExtender ID="$vaeRCash$" runat="server" TargetControlID="$valrCash$">
</cc1:ValidatorCalloutExtender>
<asp:RegularExpressionValidator ID="$valxCash$" runat="server" ControlToValidate="$txtCash$" 
    Text="*" ErrorMessage="You must provide a valid entry for Amount. #.##" SetFocusOnError="true" 
    Display="Dynamic" ValidationExpression="^-?[0-9]{0,2}(\.[0-9]{1,2})?$|^-?(100)(\.[0]{1,2})?$">
</asp:RegularExpressionValidator>
<cc1:ValidatorCalloutExtender ID="$vceXCash$" runat="server" TargetControlID="$valxCash$">
</cc1:ValidatorCalloutExtender>]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
Advertisements

About SheldonS

Web developer for over 15 years mainly with Microsoft technologies from classic ASP to .NET 4. Husband, father, and aspiring amateur photographer.

Posted on June 10, 2011, in Snippet. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: