|
@using Syncfusion.Blazor.Inputs
@using Syncfusion.Blazor.DropDowns
<div class="control-label">
Country code
</div>
<SfDropDownList TItem="CountryCode" TValue="string" PopupHeight="230px" Placeholder="Select a game" @bind-Value="@DropVal" DataSource="@codes" >
<DropDownListEvents TItem="CountryCode" TValue="string" ValueChange="OnChange"></DropDownListEvents>
<DropDownListFieldSettings Text="Code" Value="Code"></DropDownListFieldSettings>
</SfDropDownList>
<div class="control-label">
Mobile Number
</div>
<SfMaskedTextBox Mask="@mask"></SfMaskedTextBox>
@code{
public class CountryCode
{
public string Code { get; set; }
public string Mask { get; set; }
}
private List<CountryCode> codes = new List<CountryCode>() {
new CountryCode(){ Code= "+1", Mask= "000-000-0000" },
new CountryCode(){ Code= "+44", Mask= "0000-000000" },
new CountryCode(){ Code= "+91", Mask= "00000 00000" },
};
public string DropVal = "+1";
public string mask = "000-000-0000";
public void OnChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, CountryCode> args)
{
this.mask = args.ItemData.Mask;
}
}
|