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

254
Views
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
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!