我正在尝试将多个类添加到ListView中的LinkButton。
这有效:
<asp:LinkButton ID="lbAttendee" runat="server" CssClass='CheckedInTrue attendee'>
这有效:
<asp:LinkButton ID="lbAttendee" runat="server" CssClass='<%#Eval("CheckedIn") %>'>
但不
<asp:LinkButton ID="lbAttendee" runat="server" CssClass='CheckedIn<%#Eval("CheckedIn") %> attendee'>
当我以第三种方式进行时,该类按字面意思呈现,如下所示:
<a id="lvAttendees_ctrl1_lbAttendee" class="CheckedIn<%#Eval("CheckedIn") %> attendee" href="javascript:__doPostBack('lvAttendees$ctrl1$lbAttendee','')">
<span style="display:none;">2</span>
<p class="studentName">Joseph Conrad</p>
<p class="studentID">13526861</p>
</a>
答案 0 :(得分:0)
试试这个对我有用
<a id="lvAttendees_ctrl1_lbAttendee" class='<%# String.Format("CheckedIn {0} attendee", Eval("CheckedIn")) %>' href="javascript:__doPostBack('lvAttendees$ctrl1$lbAttendee','')">
<span style="display:none;">2</span>
<p class="studentName">Joseph Conrad</p>
<p class="studentID">13526861</p>
</a>