locked
Update label without reloading the page RRS feed

  • Question

  • User-146731933 posted

    Hi,

    i use asp.net (c#) and Masterpages(Visual Studio Project),

    I have a simle label which i want to uüdate without reload the whole page. I tried:

    <asp:UpdatePanel ID="UpdatePanelTasks" runat="server" UpdateMode="Conditional">
       <Triggers>
          <asp:AsyncPostBackTrigger  ControlID="Timer1" EventName="Tick" />                                                 </Triggers>
    <ContentTemplate>
      <ul class="nav top-menu">
        <li class="dropdown">
           <a data-toggle="dropdown" class="dropdown-toggle" href="index.html#">
              <i class="fa fa-tasks"></i>
              <span class="badge bg-theme"><%= (TaskCount) %></span>
           </a>
           <ul class="dropdown-menu extended tasks-bar">
              <div class="notify-arrow notify-arrow-green"></div>
              <li>
                 <p class="green"><asp:Label id="TaskLabel1" runat="server" />&nbsp;<%= (TaskCount) %>&nbsp;<asp:Label id="TaskLabel2" runat="server" /></p>
              </li>
        </ul>                                
      </ContentTemplate>
    </asp:UpdatePanel>
    asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_OnTick" />
    

    Works fine, but the whole page is reloaded. How can i solve this problem?

    Thanks a lot

    best regards

    Rene

    Thursday, March 12, 2020 10:08 AM

All replies

  • User-775646050 posted

    Are you sure about that? I just tried your code and the value changed every five seconds without reloading the rest of the page. Do you have more code you can post?

    Thursday, March 12, 2020 9:06 PM
  • User2110873642 posted

    Solve this with Javascript, that is what its for.

    https://www.w3schools.com/js/

    Learn it well, you shouldnt want to make websites without full knowledge of javascript.

    Monday, March 16, 2020 3:22 PM