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

255
Vistas
How to receive a variable in javascript from c#?

So I'm trying to open up an htm file throw a WPF UI(XAML) hyperlink and pass some coordinates to the htm file, which uses javascript to create a map that centers around, hopefully, the coordinates I'm trying to pass. coord1 and coord2 are doubles.

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
    {
        String coords = coord1 + " " + coord2;
        Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri, coords));
        e.Handled = true;
    }

This is the javascript end where I'm trying to receive the variable coords:

<script type='text/javascript'>
    var map;
    var coords = '<%=coords%>';

   function GetMap() {

    map = new Microsoft.Maps.Map('#myMap', {center: new Microsoft.Maps.Location(55, 0)});
    ...

I got '<%=coords%>' from online but it literally just returns <%=coords>. I'm trying to take the two coordinate points to replace the 55 and 0.

I didn't post the XAML code, but the C# code opens up the htm file when a hyperlink is clicked and I believe the string "coords" is being passed with the data, but I just don't know how to receive it.

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