我有以下代码,但它给了我错误
<div id="ChangePassword" title="Change password for "&<%=item.Name%>>
<%Html.RenderPartial("PasswordDetails", Model); %>
</div>
我需要在标题中显示名称。我怎么能这样做?
我实际上想要在点击链接时diplay div中员工的姓名。我怎么能这样做?
<% foreach (var item in Model.employee) { %>
<tr>
<td><%=item.Name %></td>
<td><%= Html.ActionLink("Edit", "Edit", new { userID = item.ID })%></td>
<td><a href="#" id="password_link" >Change Password</a></td>
<td> <%= Html.ActionLink("Delete", "Delete", new { id = item.ID }, new { Class = "deleteLink", title = item.Name })%></td>
</tr>
<% } %>
$("#password_link").click(function() {
$('#ChangePassword').dialog('open');
return false;
});
<div id="ChangePassword" title="Change password for <%=item.Name%>">
<%Html.RenderPartial("PasswordDetails", Model); %>
答案 0 :(得分:1)
<div id="ChangePassword" title="Change password for <%=item.Name%>">
<%Html.RenderPartial("PasswordDetails", Model); %>
</div>
你在标题标签中没有实际名称,你的报价太早结束了。
要在div中显示名称,我会执行以下操作:
<a href="#" onclick="$('#ChangePassword').attr('title', '<%= item.Name %>');
$('#ChangePassword').dialog('open');return false;"
id="password_link" >Change Password</a>