C
C#2y ago
Luciferno

Value binding

I am running in to this error: This is what my code looks like on the index.razor page
<Field InputType="Enums.InputType.Text"
Name="test"
Placeholder="test"
HasLabel="true"
LabelType="LabelType.Middle"
@bind-ValueOne="x"
@bind-ValueTwo="y"
Label="!" />
<Field InputType="Enums.InputType.Text"
Name="test"
Placeholder="test"
HasLabel="true"
LabelType="LabelType.Middle"
@bind-ValueOne="x"
@bind-ValueTwo="y"
Label="!" />
And this is in the field itself
-- Front end
<input type="text" class="form-control" @bind:get="ValueOne" @bind:set="ValueOneChanged" />
<span class="input-group-text" id="@LabelId">@Label</span>
<input type="text" class="form-control" @bind-value="@ValueTwo" />


-- CS behind file
[Parameter]
public string ValueOne { get; set; }

[Parameter]
public EventCallback<string> ValueOneChanged { get; set; }
-- Front end
<input type="text" class="form-control" @bind:get="ValueOne" @bind:set="ValueOneChanged" />
<span class="input-group-text" id="@LabelId">@Label</span>
<input type="text" class="form-control" @bind-value="@ValueTwo" />


-- CS behind file
[Parameter]
public string ValueOne { get; set; }

[Parameter]
public EventCallback<string> ValueOneChanged { get; set; }
And I am following the tutorial provided in one of the screenshots. Don't know what I am ding wrong
3 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
blinkbat
blinkbat2y ago
if blazor you can just @bind-value=@ValueOne
Luciferno
Luciferno2y ago
Sorry for the late response, turns out this is an actual issue in Blazor and .NET 7. So thats why it is giving the error