自定义ASPX代码段未在VS2010中显示

时间:2018-10-10 05:39:29

标签: asp.net visual-studio-2010 code-snippets

我想在VS2010的.aspx文件中插入摘要。我已经编写了一个代码段,使用了代码段管理器将其导入到“ ASP.NET \ My HTML代码段”文件夹中。但是,我无法使用Ctrl_K,Ctrl-X来显示它。其他所有的aspx代码段都显示出来,例如“复选框”,但我无法将代码段显示在列表中。片段可以在snippetList图像中看到。 List of defined snippets

我想插入一个名为DictionaryHTML的代码,如下所示。 (我的项目中有许多词典,它们的区别仅在于注释部分列出的5个替代项。)

在编辑.aspx页面的源代码时,我缺少什么使该代码段显示?

谢谢!

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets 
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
  <Title>DictionaryHTML</Title>
  <Author>PJH</Author>
  <Description>HTML code for standard dictionary</Description>
  <HelpUrl></HelpUrl>
  <SnippetTypes />
  <Keywords />
  <Shortcut>dictionary</Shortcut>
</Header>
<Snippet>
  <References />
  <Imports />
  <Declarations>
    <Literal Editable="true">
      <ID>PageName</ID>
      <Type>String</Type>
      <ToolTip>Name of the dictionayr</ToolTip>
      <Default>PageName</Default>
      <Function></Function>
    </Literal>
    <Literal Editable="true">
      <ID>Item</ID>
      <Type></Type>
      <ToolTip></ToolTip>
      <Default>Item</Default>
      <Function></Function>
    </Literal>
    <Literal Editable="true">
      <ID>GridName</ID>
      <Type></Type>
      <ToolTip></ToolTip>
      <Default>GridName</Default>
      <Function></Function>
    </Literal>
    <Literal Editable="true">
      <ID>PrimaryKey</ID>
      <Type></Type>
      <ToolTip></ToolTip>
      <Default>PrimaryKey</Default>
      <Function></Function>
    </Literal>
    <Literal Editable="true">
      <ID>Prefix</ID>
      <Type></Type>
      <ToolTip></ToolTip>
      <Default>Prefix</Default>
      <Function></Function>
    </Literal>
  </Declarations>
  <Code Language="html" Kind="" Delimiter="$"><![CDATA[<asp:Content 
ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<!--
Page name: $PageName$
Dictionary item: $Item$
Grid name: $GridName$
Primary key: $PrimaryKey$
Data field prefix: $Prefix$
-->

<table class="tableMain" width="95%">
<tr >
<td class="tdHeader" colspan="2">$PageName$</td>
</tr>
<tr >
<td class="tdPrompt">Message(s):</td>
<td class="tdData">
<asp:Label ID="lblMessage" runat="server"></asp:Label>
</td>
</tr>
<tr >
<td class="tdPrompt">Actions:</td>
<td class="tdData">
<asp:Button ID="btnClose" runat="server" CssClass="btnStyle" Text="Exit" 
    Font-Bold="True" Font-Size="Small" />
<asp:Button ID="btnAdd" runat="server" CssClass="btnStyle" 
    Text="Add" Width="114px" />
<asp:Button ID="btnEdit" runat="server" CssClass="btnStyle" 
    Text="Edit" Width="114px" />
<asp:Button ID="btnDelete" runat="server" CssClass="btnStyle" 
    Text="Delete" Width="128px" />
</td>
</tr>

<tr >
<td class="tdPrompt">Primary key:</td>
<td class="tdData">
<asp:Label ID="lblPrimaryKey" runat="server" CssClass="lblStyle">                        
</asp:Label>
</td>
</tr>

<tr >
<td class="tdPrompt">$Item$ ID:</td>
<td class="tdData">
<asp:Label ID="lbl$Item$ID" runat="server" CssClass="lblStyle"> 
</asp:Label>
<asp:TextBox ID="txt$Item$ID" visible="false" CssClass="txtStyle" 
    MaxLength="15" runat="server"></asp:TextBox>
</td>
</tr>

<tr >
<td class="tdPrompt">$Item$ name:</td>
<td class="tdData">
<asp:Label ID="lbl$Item$Name" runat="server" CssClass="lblStyle"> 
</asp:Label>
 <asp:TextBox ID="txt$Item$Name" visible="false" CssClass="txtStyle" 
MaxLength="50" 
    runat="server"></asp:TextBox>
</td>
</tr>


<tr >
<td class="tdPrompt">&nbsp;</td>
<td class="tdData" align="center">
<asp:Button ID="btnProceed" runat="server" CssClass="btnStyle" 
visible="false" Text="Proceed" />
<asp:Button ID="btnCancel" runat="server" CssClass="btnStyle" 
visible="false" Text="Cancel" />
</td>
</tr>

<tr >
<td class="tdPrompt">Defined $PageName$:</td>
<td class="tdData">
<asp:GridView ID="grd$GridName$" runat="server" 
AutoGenerateColumns="False" 
    AutoGenerateSelectButton="True" CssClass="grdStyle">
    <Columns>
        <asp:BoundField DataField="$PrimaryKey$" Visible="False" 
            HeaderText="$PrimaryKey$" />
        <asp:BoundField DataField="$Prefix$_ID" HeaderText="$Item$ ID" />
        <asp:BoundField DataField="$Prefix$_Name" HeaderText="$Item$ Name" 
/>
    </Columns>
</asp:GridView>
</td>
</tr>

</table>
</asp:Content>$end$]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

0 个答案:

没有答案