Skip to content

Is there an easier way to do this #26726

Answered by Ariansh
minoseah629 asked this question in General
Discussion options

You must be logged in to vote

If i understood correctly, a quick solution would be passing an enum or anything and check the method with a switch case. so the onclick method would be like ()=>clicked(MyEnum.proposal). check this

<ul class="nav nav-tabs" id="myTab" role="tablist">
  @foreach (var item in MyEnum)
  {
  <li class="nav-item">
    <a class="nav-link @((activeTab.Equals((int)item))? "active" : "")" role="tab" aria-controls="proposal" aria-selected="true"
     data-toggle="tab" href="#home" 
    @onclick="()=>clicked(item)"
    >Proposal</a>
  </li>
  }
</ul>

===========================================

void clicked(MyEnum selectedEnum)
  {
      switch(selectedEnum)
      {
          case MyEnum.proposal :
…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@minoseah629
Comment options

Answer selected by minoseah629
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants