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
Access razor component property from within a JavaScript event

A razor component binds its OnInput event to a JavaScript function. How can I read the razor component property from within the JavaScript function?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can add a method in your Razor component with the [JSInvokable] attribute. In this method you can return the properties that you need in your Javascript.

[JSInvokable]
public static Task<int[]> ReturnArrayAsync()
{
    return Task.FromResult(this.MyProperty);
}

And in javascript side:

DotNet.invokeMethodAsync('{ASSEMBLY NAME}', 'ReturnArrayAsync', {ARGUMENTS}); //in that case we do not need arguments

It should do the trick. Good luck :)

about 4 years ago · Juan Pablo Isaza Report
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!