set text to div tag from asp.net

10,677

If I understand you correctly you want to change the text from code-behind file.

use asp.net label with attribut runat=server:

<asp:Literal ID="date" runat="server" Text='31' />

and in your code:

date.Text = "updated text";

so try this:

<li> 
  <div class="evnt-date"> 
    <asp:Literal ID="date" runat="server" Text='31' />
    <span><asp:Literal ID="month" runat="server" Text='July' /></span> 
  </div>
 </li>

and your code behind file:

date.Text = "20";
month.Text = "August";

as per suggestion changed label to literal.

Share:
10,677

Related videos on Youtube

Kevin Huynh
Author by

Kevin Huynh

Updated on September 14, 2022

Comments

  • Kevin Huynh
    Kevin Huynh over 1 year

    See the code:

    <li>
        <div class="evnt-date">31<span>July</span> 
        </div>
        <div class="event-info"> <span><i class="icon-time"></i> 12:25 PM</span>
    
            <p>Anim pariatur cliche repreh enderit, enim eiusmod high life</p>
        </div>
    </li>
    

    i want to change the 31 and july value, how can i do that in asp.net

    that code come from a html with css page, i try to mod it. thank for read :D

  • Kevin Huynh
    Kevin Huynh over 10 years
    thank you, but it can not save the style of text s23.postimg.org/qktr64z7v/Untitled.png
  • Jignesh Suvariya
    Jignesh Suvariya over 10 years
    you can use asp:Litral control instead of asp:Label in above design