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

196
Vistas
Variable in the JavaScript in C#
ClientScript.RegisterStartupScript(
    Page.GetType(),
    "INFORMATION",
    @"PopupMessage(""INFORMATION"", ""Data was created successfully"", false);",
    true);

The code above show the JavaScript code in C# code behind

What I want to do is add the variable to the message

but I used this code which does not work:

ClientScript.RegisterStartupScript(
    Page.GetType(),
    "INFORMATION",
    @"PopupMessage(""INFORMATION"", """+Data+" was created successfully"", false);",
    true);

It throws error:

Error CS1501 No overload for method 'RegisterStartupScript' takes 5 arguments

Does someone know how to make it work?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This string literal is a syntax error:

" was created successfully"", false);"

One of the things the verbatim identifier does for a string is change the way double-quotes are interpreted. Without it, double-quotes need to be escaped. But with it, escaping doesn't work (because it's a verbatim string) so a special consideration needs to be made for double-quotes. To add them to a string you need to "double" them.

This is why your other string literal works as expected:

@"PopupMessage(""INFORMATION"", """

To achieve the same thing in the failing string literal, use the verbatim identifier again:

@" was created successfully"", false);"
about 4 years ago · Juan Pablo Isaza Denunciar
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