user6628729
user6628729

Reputation: 323

Label on page html css

I try to display message where there is no data so for this first I create label:

  <asp:Label ID="Label4"   class="labfour"  runat="server" Text=""></asp:Label><br /><br />

and CSS class

.labfour
{
    background-color: #FADBD8;
    color: #E74C3C;
    border-color: #E74C3C;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 20px;
    padding-bottom: 20px;
    margin-left: 320px;
}

Then when I build page label is display on page with background color red..

enter image description here

When I write this display:none and click on button then message not display when I remove this then message is displayed.

So how to hide on page when page is build?

I try to show message through jquery

if (myData !== null && Object.keys(myData).length !== 0) {
    strarr = result.d;
    var myarr = strarr;
    Drewchart(myarr);
    $("#tabledata").show();
    $("#container").show();
    $("#<%=Label5.ClientID%>").hide();                    
} else {
    $("#tabledata").hide();
    $("#container").hide();
    $("#cont").hide();
    $("#<%=Label5.ClientID%>").show();
    $("#<%=Label5.ClientID%>").text("DATA NOT FOUND");
    return;
}

Upvotes: 0

Views: 44

Answers (1)

GURURAJ DHARANI
GURURAJ DHARANI

Reputation: 468

So this is how you display message on label and if ur hiding it ofcourse it will hide whole thing as you are using single tag. if you just want to hide message on the label probably use span inside

.labfour{
   background-color: #FADBD8;
    color: #E74C3C;
    border-color: #E74C3C;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 20px;
    padding-bottom: 20px;
    margin-left: 320px;
}
<asp:Label ID="Label4"   class="labfour"  runat="server" Text="">Your message here</asp:Label>

Upvotes: 2

Related Questions