Skip to content

Select on Modal with Form not working #698

Closed
@JitenPatoliya

Description

I have a Modal with Form and multiple Input
When I tried to add module: Select as one of the control its not working as expected (Not getting Drodown values (select options).

Code that Reproduce issue - Start

Open Modal Select:
<Form Model="_formModal">
    <FormItem>

        <Select @bind-Value="@context.Name" 
                DefaultValue=@("099") 
                Options="@_options"
                Style="width:120px" AllowClear>
        </Select>

        <Select @bind-Value="@context.Name" DefaultValue=@("lucy") Style="width:120px" AllowClear>
            <SelectOption Value="lucy">Lucy</SelectOption>
            <SelectOption Value="lucy1">Lucy 1</SelectOption>
            <SelectOption Value="lucy2">Lucy 2</SelectOption>
            <SelectOption Value="lucy3">Lucy 3</SelectOption>
        </Select>

    </FormItem>
</Form>

@code{
class FormModal
{
public string Name { get; set; } = "099";
}

string title = "BasicModal";
bool _visible = false;
List<LabeledValue> _options = new List<LabeledValue>();

private FormModal _formModal = new FormModal();

protected override void OnInitialized()
{
    const int min = 0;
    const int max = 36;
    //_options = new LabeledValue[max - min];

    for (var i = min; max > i; i++)
    {
        var disabled = i == 10;
        var value = Convert.ToString(i, 16).PadLeft(2, '0') + i.ToString();
        //_options[i] = new LabeledValue(value, value);
        var lval = new LabeledValue(value, value);
        _options.Add(lval);
    }
}

private void HandleOk(MouseEventArgs e)
{
    if (e == null) return;
    Console.WriteLine(e);
    _visible = false;
}

private void HandleCancel(MouseEventArgs e)
{
    if (e == null) return;

    Console.WriteLine(e);
    _visible = false;
}

}

Code - End

Exceptions (if any)

Further technical details

  • AntDesign Nuget Package version - v0.3
  • Include the output of dotnet --info
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version - vs 2019 - 16.7.5

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions