Here is a simple demo you could follow:
<select id="condition" @onclick="@Hide" @bind="@SelectedOpt" >
<option value="0">Servers</option>
<option value="1">Owner</option>
<option value="2">DataBases</option>
</select>
<div class="row">
<div class="col-lg-12 col-12 row">
<div class="col-md-3 col-lg-2">
<div style="display:@ShowDropdown1; flex-direction: row; justify-content: center; align-items: center">
<span class="text-sm mb-0 text-capitalize font-weight-bold">Servers</span>
  
<select class="form-select" @bind="@appfilter.serverID">
<option value="0">--All--</option>
<option value="1">Server1</option>
<option value="2">Server2</option>
</select>
</div>
</div>
<div class="col-md-3 col-lg-2">
<div style="display:@ShowDropdown2; flex-direction: row; justify-content: center; align-items: center">
<span class="text-sm mb-0 text-capitalize font-weight-bold">Owner</span>
  
<select class="form-select" @bind="@appfilter.ownerId">
<option value="0">--All--</option>
<option value="1">Owner1</option>
<option value="2">Owner2</option>
<option value="3">Owner3</option>
</select>
</div>
</div>
<div class="col-md-3 col-lg-2">
<div style="display:@ShowDropdown3; flex-direction: row; justify-content: center; align-items: center">
<span class="text-sm mb-0 text-capitalize font-weight-bold">DataBases</span>
  
<select class="form-select" @bind="@appfilter.databaseId">
<option value="0">--All--</option>
<option value="1">database1</option>
<option value="2">database2</option>
<option value="3">database3</option>
</select>
</div>
</div>
</div>
</div>
@code {
public Appfilter appfilter { get; set; } = new();
public string SelectedOpt { get; set; } = "";
public class Appfilter
{
public int serverID { get; set; }
public int ownerId { get; set; }
public int databaseId { get; set; }
}
private string ShowDropdown1 { get; set; } = "flex";
private string ShowDropdown2 { get; set; } = "flex";
private string ShowDropdown3 { get; set; } = "flex";
private void Hide()
{
if (SelectedOpt=="0")
{
ShowDropdown1 = "flex";
ShowDropdown2 = "None";
ShowDropdown3 = "None";
}
else if(SelectedOpt=="1")
{
ShowDropdown2 = "flex";
ShowDropdown1 = "None";
ShowDropdown3 = "None";
}
else if(SelectedOpt=="2")
{
ShowDropdown3 = "flex";
ShowDropdown1 = "None";
ShowDropdown2 = "None";
}
}
}
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards,
Rena