我在 asp.net 中继器中有下载链接以下载 .pdf 文件,但我想隐藏没有 .pdf 文件扩展名的链接。
javascript
// get file extensions
var fileURL = $('hl_download').attr("href");
// get file extensions
var fileURL = $('hl_download').attr("href");
function getFileExtension(fileURL) {
return filename.split('.').pop();
}
var fileExtension = getFileExtension(fileURL);
if (fileExtension == null) {
$('hl_download').addClass("hideLinke");
}
asp-markup
<asp:Repeater ID="rp_resList" runat="server" OnItemDataBound="rp_resList_ItemDataBound" OnItemCommand="rp_resList_ItemCommand">
<ItemTemplate>
<div class="resource">
<div class="resource-head clearfix">
<img class="pull-left" src="/ideapark/DesktopModules/ResourcesFilter/img/<%# Eval("typeId") %>.png" alt="icon type" width="36" height="36" />
<p class="resource-title pull-left">
<asp:Literal ID="litType" runat="server" Text='<%# Eval("resType") %>'></asp:Literal>
</p>
<div class="favorite-resource favorited pull-right">
<asp:ImageButton ID="imgBtn_bookmark" runat="server" CommandName="bookmark_res" ImageUrl="~/DesktopModules/ResourcesFilter/img/off.png" />
</div>
</div>
<div class="resource-body">
<asp:HiddenField ID="hf_resID" runat="server" Value='<%# Eval("Id") %>' />
<p class="resource-subtitle"><a href='<%# Eval("pageID") %>'><%# Eval("name") %></a></p>
<p>
<asp:Literal ID="litSummary" runat="server" Text='<%# Eval("summary") %>'></asp:Literal>
</p>
<div class="resource-links">
<p><a class="resource-like" href="#">Like</a> <strong>·</strong> <asp:HyperLink ID="hl_download" runat="server" CssClass="resource-download" NavigateUrl='<%# Eval("pdf_Doc_url") %>' ClientIDMode="Static">Download</asp:HyperLink> </p>
</div>
<div class="resource-tags clearfix">
<asp:Repeater ID="rp_tagsTopics" runat="server">
<ItemTemplate>
<span class="resource-tag pull-left">
<asp:LinkButton ID="lnkBtnTags" runat="server" Text=' <%# Container.DataItem %>' OnClick="LinkButton1_Click"> <%# Container.DataItem %></asp:LinkButton>
</span>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>