类型'System.Web.UI.WebControls.ImageButton'没有名为'TemplateField'的公共属性

时间:2011-10-12 08:21:01

标签: asp.net gridview imagebutton skin

<asp:GridView ID="grdCatgory" runat="server" AutoGenerateColumns="false">
    <Columns>
        <asp:BoundField DataField="Name" HeaderText="Name" />
        <asp:BoundField DataField="Description" HeaderText="Description" />
        <asp:TemplateField HeaderText="Edit">
            <ItemTemplate>
                <asp:ImageButton ID="imgEdit" runat="server" CommandArgument="<%Eval("CategoryID")%>"
                    CommandName="Edit" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Delete">       
            <ItemTemplate>
                <asp:ImageButton ID="imgDel" runat="server" CommandArgument="<%Eval("CategoryID")%>"
                    CommandName="Del" />
            </ItemTemplate>
        </asp:TemplateField>  

    </Columns>
</asp:GridView>

我在构建网站时遇到以下错误...

Type 'System.Web.UI.WebControls.ImageButton' does not have a public property named 'TemplateField'

1 个答案:

答案 0 :(得分:2)

我认为CommandArgument="<%Eval("CategoryID")%>" 需要改变

 `CommandArgument="<%#Eval("CategoryID")%>"`