1

我在第 17 行遇到错误。但我找不到。`

Line 15:  <asp:Repeater ID="ArticleRepetear" runat="server" DataSourceID="SqlDataSource1" OnItemCommand="ArticleRepetear_ItemCommand">
Line 16:  <ItemTemplate>
Line 17:  <asp:LinkButton ID="TitleLinkButton" runat="server" OnCommand="TitleLinkButton_Click" CommandArgument="<%#Eval("id").ToString() %>">
Line 18: <h1><%#Eval("title") %></h1>
Line 19: </asp:LinkButton>`

我在语法中缺少什么?

4

2 回答 2

7

错误是在双引号中CommandArgument:-

CommandArgument="<%#Eval("id").ToString() %>">

将其更改为:-

CommandArgument='<%#Eval("id").ToString() %>'>
于 2015-03-20T06:01:33.457 回答
1

改变: CommandArgument='<%#Eval("id").ToString() %>'

<asp:LinkButton ID="TitleLinkButton" runat="server" 
OnCommand="TitleLinkButton_Click" CommandArgument="<%#Eval("id").ToString() %>">
 <h1><%#Eval("title") %></h1>
</asp:LinkButton>`

 <asp:LinkButton ID="TitleLinkButton" runat="server" 
        OnCommand="TitleLinkButton_Click" CommandArgument='<%# Eval("id").ToString() %>'>
<h1><%#Eval("title") %></h1></asp:LinkButton>`
于 2015-03-20T05:57:30.113 回答