I am using an ASP .NET web form, where in I display certain <asp:Label .. />
controls inside a repeater.
I have tried to replicate my problem in a fiddle : http://jsfiddle.net/abhighosh18/0sd99jnk/3/
(Note in the fiddle I have not kept any asp controls. I have tried to replicate my problem using HTML controls that appear after ASP controls are rendered)
What I want is on :hover
of the label, the fa fa-times
sign should appear and I should be able to remove that label on the click of it from the DOM and the DB itself.
I can handle the backend, but my first problem is the CSS positioning of the fa fa-times
symbol.
Currently my ASPX code looks like this :
<div class="box-body compDiv">
<asp:Repeater ID="rptr" runat="server">
<ItemTemplate>
<asp:HiddenField ID="hfCoID" runat="server" Value='<%# Eval("CompID") %>' />
<asp:Label ID='CompanyID' runat="server" CssClass="btn-sm btn-success compName" Text='<%# Eval("CompName") %>' />
<asp:LinkButton runat="server" ID="lnkBtnRemove" CssClass="btnRemove" OnClientClick="return confirm('Are you sure you want to remove this company ?');"><i class="fa fa-times"></i></asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
</div>
And my CSS(in MASTER PAGE) is :
<style type="text/css">
a.btnRemove {
display: none;
}
div.compDiv:hover a.btnRemove {
display: block;
position: relative;
}
div.compDiv a.btnRemove {
top: 0;
}
</style>
What this does is on the hover of the div the fa class appear. I really want them to appear on hover of a single Label
control.
My DOM after rendering looks like this :
What I tried was :
span.compName:hover a.btnRemove{
display: block;
position: relative;
}
But this doesn't work unfortunately.
Any ideas ?