Label and background image in css file

hi there, I hope your help.

I need in my aspx page replace this layout:

to change new layout with inserting new values of my code behind:

            Label1.Text = Convert.ToString(dr["myDates"]);
            TITLE = Convert.ToString(dr["TITLE"]);

But I have this output wrong because the image is canceled and the value of date is left and not supported in the initial image:

css file:


.templatemo_product
{
    float: left;
    width: 455px;
    height: 105px;
    padding: 10px;
    background: url(images/templatemo_products.jpg) no-repeat;
    display:block
}

aspx file:


            <div class="templatemo_product">
                <asp:Label ID="Label1" runat="server">
                <img src="images/templatemo_photo1.jpg" alt="templatemo.com"
                    width="117" height="76" />
                <strong>Vivamus a massa</strong><br />
                Donec iaculis felis id neque. Morbi nunc. Praesent varius egestas velit. Donec a
                massa ut pede pulvinar vulputate. Nulla et augue. Sed eu nunc quis pede tristique
                suscipit. Nam sit amet justo vel libero tincidunt dignissim.
                </asp:Label>
                <a href="#"><strong>READ MORE </strong></a>
            </div>

code-behind:

            Label1.Text = Convert.ToString(dr["myDates"]);
            TITLE = Convert.ToString(dr["TITLE"]);

Can you help me?

Could you provide a link to your page so people can see what HTML code is being rendered and therefore what the issue looks like?

Also, I could be wrong about this since I haven’t touched an ASP.Net site in ages, but shouldn’t that closing label control tag go right after the opening tag? Like so:


<asp:Label ID="Label1" runat="server"></asp:Label>

You could also just write it like this as a self-closing tag:


<asp:Label ID="Label1" runat="server" />

And for what you’re using the label control for, it might make more sense to use a LITERAL control instead of a label control. Check out this old blog entry that does a good job of explaining the difference between the two - http://haacked.com/archive/2007/02/14/asp.net_tip_-_use_the_label_control_correctly.aspx

As @imouto ; started to hint on your label tag contains TOO much, so when you assign the .Text property, you are overwriting what is already contained in the label.

                <asp:Label ID="Label1" runat="server">
                <img src="images/templatemo_photo1.jpg" alt="templatemo.com"
                    width="117" height="76" />
                <strong>Vivamus a massa</strong><br />
                Donec iaculis felis id neque. Morbi nunc. Praesent varius egestas velit. Donec a
                massa ut pede pulvinar vulputate. Nulla et augue. Sed eu nunc quis pede tristique
                suscipit. Nam sit amet justo vel libero tincidunt dignissim. 
                </asp:Label>

Write the label so it includes ONLY want you want to overwrite, or use a self-closing tag so you can inject new text into your existing content.

thank you.