@using Syncfusion.Blazor.Buttons; @using Syncfusion.Blazor.Inputs; @using Syncfusion.Blazor.InPlaceEditor;
<SfTextBox @bind-Value="textVal" Placeholder='Enter To-Do list'></SfTextBox> <SfButton ID="dynamic-button" Content="Add" @onclick="ChangeAttribute"></SfButton> @foreach(var list in ToDo) { @if (flag) { <div id="component-container"> <SfInPlaceEditor @bind-Value="@list.textValue" TValue="string"> <EditorComponent> <SfTextBox @bind-Value="list.textValue" Placeholder="Enter employee name"></SfTextBox> </EditorComponent> </SfInPlaceEditor> </div> } else { <div id="component"> </div> } } @code { public bool flag { get; set; } public string textVal {get ;set;}
public class ValueList{ public string textValue { get; set; } } public List<ValueList> ToDo = new List<ValueList>(); private void ChangeAttribute() { flag = true; ToDo.Add(new ValueList { textValue = textVal }); } }
|