We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Textboxes not populating

Thread ID:





148577 Oct 25,2019 10:49 AM UTC Oct 31,2019 02:16 PM UTC Blazor 1
Tags: TextBox
Asked On October 25, 2019 10:49 AM UTC

I have a page with a datagrid that has several records. I have added a command column that has a custom button. The button navigates to a details page for the selected record. On the details page, I have the page directive set as :  @page "/details/{Id:int}"
In the @code section I have a parameter:  public int Id { get; set;}
When I have only one textbox, it populates fine. But when I add additional textboxes for the rest of the fields, none of the boxes are populated.

     public int Id { get; set;}
     Contact contact = new Contact();

     protected override async Task OnInitializedAsync()
        contact = await contactService.GetContactByIdAsync(Id);

That is how my code looks in the details page. Each textbox is bound by using:  @bind-Value="@contact.FirstName", with their respective field names.
With a single textbox, it works. When I add additional textboxes, nothing populates.

Please help


Narayanasamy Panneer Selvam [Syncfusion]
Replied On October 31, 2019 02:16 PM UTC

Hi Michael, 

Greetings from Syncfusion support. 

We have validated your problem in the reported use case scenario. We suspect that you may set same ID to the TextBoxComponents. So, the probability that you may get overlapping of textbox components or getting updated value in first textbox. 
So kindly use different ID for each component rendering. 
Code example: 
<EjsTextBox ID="@("text" + Id.ToString())" @bind-Value="@name"></EjsTextBox> 
<EjsTextBox ID="@("text1" + Id.ToString())" @bind-Value="@name"></EjsTextBox> 
<EjsTextBox ID="@("text2" + Id.ToString())" @bind-Value="@name"></EjsTextBox> 
    public int Id { get; set; } 
    public string name { get; set; } 
    protected override async Task OnInitializedAsync() 
        name = await ForecastService.GetForecastAsync(Id); 

For your convenience we have prepared a sample with reported scenario.

Demo sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/TextBox_route-2129771936

Narayanasamy P.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon