Binding value of database

Hello,

when I save the data of my customer, the data is saved correctly, my field Document_Type=1 or 2 or 3 depend by dropdownlist.

When reload the record the dropdownlist not bind correctly the record value, show always the first choice.

This my code:

<SfDropDownList TItem="_TipoDocumento" TValue="string"

                    PopupHeight="230px"

                    @bind-Index="@ddlIndex"

                    Placeholder="Seleziona Tipo documento"

                    DataSource="@_TipoDocumento.TipoDocumentos"

                    FloatLabelType="@FloatLabelType.Always"

                    @bind-Value="@objClienti.TipoDocumento">

      <DropDownListFieldSettings Text="Text" Value="ID"></DropDownListFieldSettings>

    </SfDropDownList>


Attachment: WhatsApp_Video_20220118_at_19.17.10.mp4_4139d5ee.zip

1 Reply

PM Ponmani Murugaiyan Syncfusion Team January 19, 2022 07:19 AM UTC

Hi Luigi, 

We suggest you to enable the EnablePresistance property to persist the selected value in the component. 


SfDropDownList ID="AutoComplete" TItem="GameFields" TValue="string" @bind-Index="@ddlIndex" EnablePersistence="true" PopupHeight="230px" Placeholder="Seleziona Tipo documento" @bind-Value="@DropDownValue" DataSource="@Games" FloatLabelType="@FloatLabelType.Always"> 
    <DropDownListFieldSettings Text="Text" Value="Text" /> 
</SfDropDownList> 
 
@code { 
    private int? ddlIndex { get; set; } = 0; 
} 
  

Regards, 
Ponmani M 


Loader.
Up arrow icon