I have a problem related to the SfMaskedTextBox component, in which it is not filled with
the value of the object(@bind-Value).
I have already tested whether the variable arrives correctly and it is correct, so much so that I test it together with an SfTextBox,
and correctly shows the value of the object.
One observation: I noticed that the problem occurs when I use SfTab on the same page as SfMaskedTextBox, I did tests removing the SfTab and the SfMaskedTextBox displays the value of the object, I don't know if there is any relationship.
Follow the maskedTextBox and textbox code:
<SfTab HeaderPlacement="HeaderPosition.Top">
<TabItems>
<TabItem>
<HeaderTemplateData/HeaderTemplate>
<ContentTemplate>
<SfMaskedTextBox Width="100px" Mask='00.000.00' Value="@userModel.Code"> </SfMaskedTextBox>
<SfTextBox @bind-Value="@userModel.Code"></SfTextBox>
</ContentTemplate>
< /TabItem>
< /TabItems>
< /SfTab>
@code{
public CESTModel userModel;
protected override async Task OnInitializedAsync()
{
UserService userService = new();
userModel = await userService.search(id);
}
}
Best regards to the SyncFusion developer and support team
Hi Guilherme,
Based on the shared information we have created a sample and validated the reported scenario on our end. But unfortunately, we were unable to reproduce the reported issue as per your scenario with. We have also shared a sample and video for your reference. In order to assist us in identifying the problem and provide a better solution, we kindly request that you provide additional details about the issue, as mentioned below:
|
|
Sample: https://blazorplayground.syncfusion.com/LtrqsisggFIagjCo
Regards,
Udhaya Kumar D
I would like to thank you for the feedback, your example worked for me.
However, there is a difference between your example and my code.
In my code the object comes from a model with the same get set property as its declared variable, but in mine it doesn't work if I inject the object directly into the @bind-value or the Value of the SfMaskedTextBox component, it only works if I assign " "" "" an empty string the variable declared within the model.
my model:
public class ModeloLoja {
public string number{ get; set; }
}
my code
protected override async Task OnInitializedAsync() { ModeloLoja item = new();
item = await service.search(id)
}
component:
<SfMaskedTextBox Mask='00-00000.0000' Value="@item.number" Width="120px" FloatLabelType="FloatLabelType.Always"></SfMaskedTextBox>
In this case, it doesn't work with @bind-value or Value
Hi Guilherme,
We have validated the query regarding setting values from the model to the Masked TextBox component. We understand the importance of effectively binding values within our components, and we've created a sample based on the information you shared. This sample demonstrates how to seamlessly set values from the model to the Masked TextBox and the value is properly bind to the component. Kindly check it out the attached sample.
Regards,
Yohapuja S