Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
How to bind title in MVC using knockout

I am trying to display a title on the image. When I am on the signing page, the data-bind title working fine and I can see the title displaying over the image. However, as soon as I sign in, the data-bind title stops working.

 
_layout.cshtml

<nav class="navbar navbar-fixed-top">
        <div class="container" style="width:100%">
            <div class="navbar-header" style="height:50px">
                <a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand" 
                   style="margin-left:2px;margin-top:12px;padding:0px;margin-top:7px">
                    <img style="margin-top:4px;height:32px;" data-bind="attr: {title: versionNumber()}" src="~/images/Scheduler-transparent.png" />
                </a>
            </div>
            @await Html.PartialAsync("_LoginPartial")

        </div>
    </nav>

JS file that gets value I want to display on the logo

// versionNumber.js

var versionNumber = ko.observable('');

var url = window.location.origin + '/account/GetVersionNumber';

CallService("Get", url)
    .done(function (data) {
        versionNumber(data);
        console.log("Version number", versionNumber());
    });

The title on signing page is being added on img element enter image description here

But not after I sign in enter image description here

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda