Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

why my component does not render when click button again

$
0
0

when I click on button for the first time notification component was render but when I click on button again this component not render , why ?

what should i do for rerender notification component?

//home.cs//some code with html

<button type="button" class="btn btn-sm bg-juice text-light rounded-circle float-start" @onclick="CheckProductVersion">

<Notification ShowAlert="@ShowAlert" AlertClass="@AlertClass" AlertMessage="@AlertMessage" />//some code with html@code{ private bool ShowAlert { get; set; } private string AlertClass { get; set; } = "alert-info"; private string AlertMessage { get; set; } private async Task CheckProductVersion() { try  {   await UpdateWorker.CheckUpdate();   ShowAlert = true;   AlertClass = "alert-success";   AlertMessage = "version updated";   await Task.Delay(1);  }    catch (Exception)  {   ShowAlert = true;    AlertClass = "alert-danger";   AlertMessage = "error in update version";   await Task.Delay(1);  } }}@if (ShowAlert){<div class="container-fluid"><div class="row"><div class="=col-sm-12 col-sm-12 col-md-6 col-lg-4 col-xl-4"><div class="alert @AlertClass mt-2 p-0" role="alert"><button type="button" class="btn" onclick="CloseAlert"><span class="bi-x-circle"></span></button>                @AlertMessage</div></div></div></div>}@code{[Parameter] public bool ShowAlert { get; set; } = false;[Parameter] public string AlertClass { get; set; } = "alert-info";[Parameter] public string AlertMessage { get; set; }private void CloseAlert(){    ShowAlert = false;} }

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>