Send C#/razor to javascript function -
how can make work:
@foreach (var alert in model.alertsrelatedtobrand) { <li class="notifications-row"> <div class="notifications-icon notifications-icon-alert"> </div> <div class="notifications-text"><a>@alert.title</a></div> <a href="#" class="notifications-dismiss" onclick="onhidealertclick(@alert.id)">x</a> // here problem </li> } i want send id of each alert function if item clicked.
your code appears correct use of @alert.id should output value existing onhidealertclick() function :
onclick="onhidealertclick(@alert.id)" it's worth noting if id property integer, may want try wrapping parameter within single quotes pass along string seen below :
onclick="onhidealertclick('@alert.id')"
Comments
Post a Comment