Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!