Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

cascade dropdown not working



<div class="row" >
<div class="col-md-4">
<select aria-label="Select a Impact Level"
data-control="select2"
data-placeholder="Select an Impact Level..."
class="form-select form-select-solid form-select-lg fw-semibold select2-hidden-accessible" onchange="@CountryClicked">
<option value="">-- Select Country --</option>
@foreach (var country in ProcessImpactTypes)
{
<option value="@country.ProcessImpactTypeId">@country.ProcessImpactTypeName</option>
}
</select>
</div>
<div class="col-md-4">
<select aria-label="Select a Impact Level"
data-control="select2"
data-placeholder="Select an Impact Level..."
class="form-select form-select-solid form-select-lg fw-semibold " onchange="@CityClicked">
<option value="">-- Select City --</option>
@if (ImpactLevelMasters != null)
{
@foreach (var city in ImpactLevelMasters)
{
<option value="@city.ImpactLevelMasterId">@(city.Level + "|"+ city.LevelValue)</option>
}
}
</select>
</div>
</div>




protected async void CountryClicked(ChangeEventArgs countryEvent)
{
int value = Convert.ToUInt16(countryEvent.Value);
ImpactLevelMasters = await ProcessImpactBizServices.GetProcessImpactLevelByProcessImpactTypeId(value, ClientId);
EditImpactType.ProcessImpactTypeId = value;
StateHasChanged();
//cityList.Clear();
//cityName = string.Empty;

//countryId = countryEvent.Value.ToString();
//countryName = countryList.FirstOrDefault(s => s.CountryId == countryId).CountryName;


this.StateHasChanged();
}

void CityClicked(ChangeEventArgs cityEvent)
{
//cityName = cityEvent.Value.ToString();
this.StateHasChanged();
}


cascade dropdown is not working wth above code only first time value render to second dropdown then it does not work.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi,

Thank you for reaching out to us.

Your code looks fine and it should work. I guess in your GetProcessImpactLevelByProcessImpactTypeId you are fetching some data, please make sure that data is fetched correctly and ImpactLevelMasters is not empty.

Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(