Search code examples
bindingtextboxblazor-server-side

how to bind value RadzenTextBox blazor


iam trying to use Rdzen library into a form and i use its textbox but its not working when i want to use the @bind-Value=item.Value propertie ... ineed to get the value of the textbox when i submit the form but don't know how with this library

here my code

when i use this it work but no bindind to the object

<RadzenTextBox [email protected] style="width: 100%;" [email protected] />

Solution

  • my pb seems to be because of the dictonary where i loop to bind with the value of it....

    To bind, in my case i find the solution by binding an object variable like

     public class FilTemp
        {
            public string key { get; set; }
            public string value { get; set; }
    
        }
                        List<FilTemp> listFilTemps = new List<FilTemp>();
                        @foreach (var item in listFilTemps)
                        {
                            <div class="align-items-center d-flex col-md-5">
                                <RadzenLabel Style="font-style:italic" [email protected] />
                            </div>
                            <div class="col-md-7">
    
                                <RadzenTextBox @bind-Value=item.value style="width: 100%;" />
    
                            </div>
                            
                        }
    

    It worked.