Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

107
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda