question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preview 7 Blazor ServerSide @Bind VS (value + @onchange) Type Conversion

See original GitHub issue

Hello! I open another issue here, since @guardrex recommended so here https://github.com/aspnet/AspNetCore.Docs/issues/13539#issuecomment-516067902

It’s related to https://github.com/aspnet/AspNetCore/issues/12690

The issue is that if I use @bind inside a custom input component, while it binds the property with the <input> value, it doesn’t raise any callback for parent components using it be notified.

So @mkArtakMSFT recommended using the (value + @onchange) route, which is fine… but then I lose the automatic type conversion that @bind provides…

For example, if I use @bind , the <input> value (if I use decimal type), gets formatted with my current computer’s number formatting settings… If I change those settings, the formatting works accordingly.

With the (value + @onchange) way, I have to provide the type conversion system myself, is this the way it should work?

Regards!!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rynowakcommented, Jul 30, 2019
1reaction
guardrexcommented, Jul 29, 2019

@chrdlx There are a couple of doc issues for Pre8 that indicate new functionality in these areas for Pre8. I suppose none of it will work until Pre8, but you could try adding type="number" step="any" to your <input> to see if it has any effect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blazor: How to use the onchange event in <select> when ...
Firstly you cant use @onchange since it would internally be used by @bind . You should be able to access the selected value...
Read more >
ASP.NET Core Blazor performance best practices
Tips for increasing performance in ASP.NET Core Blazor apps and avoiding common performance problems.
Read more >
ASP.NET Core Blazor data binding
Razor components provide data binding features with the @bind Razor directive attribute with a field, property, or Razor expression value.
Read more >
Blazor MultiColumnComboBox - Events - Documentation
The ValueChanged event fires upon every change of the user selection. When custom values are enabled, it fires upon every keystroke, like in...
Read more >
JavaScript Data Binding with Knockout.js
Get powerful, client-side data binding in JavaScript using Knockout. ... the model) via the view model; a "value converter," so to speak.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found