Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventCallback for second binding value not work #16937

Closed
nguyenvanbien95 opened this issue Nov 9, 2019 · 2 comments
Closed

EventCallback for second binding value not work #16937

nguyenvanbien95 opened this issue Nov 9, 2019 · 2 comments
Labels
affected-very-few This issue impacts very few customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one investigate severity-minor This label is used by an internal tool
Milestone

Comments

@nguyenvanbien95
Copy link

I have two values for binding form parent component to child component.

First value is binded success but second value is not work.

To Reproduce

Child.cs

    // display Value1, Value2

    @code {

    [Parameter] Type1 Value1{ get; set; }
    [Parameter] EventCallback<Type1 > Value1Changed { get; set; }
    [Parameter] Type2 Value2{ get; set; }
    [Parameter] EventCallback<Type2 > Value2Changed { get; set; }

    override async Task OnInitializedAsync() 
    {
            var dbData = await Service.GetAsync();
            Value1 = dbData.Item1;
            Value2 = dbData.Item2;
            await Value1Changed.InvokeAsync(Value1);
            await Value2Changed.InvokeAsync(Value2);
    }
    }

Parent.cs

    <Child @bind-Value1="Value1" @bind-Value2="Value2"></Child>

    @code {
    Type1 Value1{ get; set; }
    Type2 Value2{ get; set; }
    }

When child Initialized, Value1 is send back to parent, Value2 is changed to value of Value2 of parent(not change value in parent).
Parent load: Value1 = 0, Value2 = 0
Child load: Value1 = 1, Value2 = 2
=> after send to Parent:
Parent: Value1 = 1, Value2 = 0
Child : Value1 = 1, Value2 = 0

It seem not good practice. I can change code for a object contain both. But I want to sure this is not a bug?

Further technical details

  • ASP.NET Core version 3.0
  • Include the output of dotnet --info
    .NET Core SDK (reflecting any global.json):
    Version: 3.0.100
    Commit: 04339c3a26

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\

Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33

  • The IDE is visual studio 2019 v16.3.7
@javiercn javiercn added the area-blazor Includes: Blazor, Razor Components label Nov 10, 2019
@javiercn
Copy link
Member

@nguyenvanbien95 thanks for contacting us.

@SteveSandersonMS thoughts?

@mkArtakMSFT mkArtakMSFT added this to the 5.0.0-preview1 milestone Nov 11, 2019
@pranavkm pranavkm removed their assignment May 7, 2020
@javiercn javiercn added affected-very-few This issue impacts very few customers enhancement This issue represents an ask for new feature or an enhancement to an existing one severity-minor This label is used by an internal tool labels Oct 9, 2020 — with ASP.NET Core Issue Ranking
@mkArtakMSFT
Copy link
Member

Hi. Thanks for contacting us.
We're closing this issue as there was not much community interest in this ask for quite a while now.
You can learn more about our triage process and how we handle issues by reading our Triage Process writeup.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-very-few This issue impacts very few customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one investigate severity-minor This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests

4 participants