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

106
Visualizações
ASP.NET View.aspx transform strings when start by zeros

In my .aspx view I have a button to delete the object that the user is watching from the model. Before it confirm the action, I show a confirm message with jquery:

$('#btDelete').click(function(e) {
  e.preventDefault();
  $.confirm({
    'title': 'Delete',
    'message': "You will delete the object <i>" + <%: Model.Reference.ToString() %> + "</i>. Do you want to continue?",
    'buttons': {
      'Si': {
        'class': 'blue',
        'action': function() {
          //some code to make the delete
        }
      },
      'No': {
        'class': 'gray',
        'action': function() {}
      }
    }
  });
});

The problem is the message section: 'message': "You will delete the object <i>" + <%: Model.Reference.ToString() %> + "</i>. Do you want to continue?". When I show Model.Reference.ToString(). Reference is an string that represent the object (yes, I also try removing the ToString()). When the message displays the reference, in some cases works good and show the Reference (it's normaly a number):

enter image description here

But the problem is when that number begins by 0. If it's all 0 and then some number, it remove all 0 and only show the last number. For example, the string 0003 it shows as:

enter image description here

But more extrange is when the refence alternate 0 with other numbers. For example, the object with reference 03030 IT TRANSFORM AS 1560. Why?

enter image description here

As you can see in the image, in the title of the page (Details view) it displays correctly the reference (03030) and I use the same: </h1><%: Model.Reference %></h1>. But in the confirm message it made some extrange transformation and convert 03030 to 1560.... Any idea why this is happening?

Also, If there are some letter (like at666) the message don't even open. I tried with the message 'message': "You will delete the object. Do you want to continue?" And it works, so the problem is <%: Model.Reference.ToString() %>

This is the Model:

public class ObjectModelDetail
    {

        public int Id { get; set; }
        public string Reference { get; set; }
        public string Ramo { get; set; }
        public string FechaCreacion { get; set; }
        public string FechaFinalizacion { get; set; }
}
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