I want to create a div from every object in my model, and I need to give them unique IDs for the onclick-method. How do I do this? I tried to put myid inside <%= %> as I read somewhere, it does not work.
This is my code:
@foreach(var r in Model){
var myid = r.ToString();
<p class="expand-one" onclick="showhide('<%= myid %>')" onmouseover="" style="cursor: pointer;">@r.ToSection.Name</p>
<table id=@myid class="content-one">
<tr>
......................
..................
<%= myid %>you could passthis.getElementsByTagName("table")[0](the element rather than the string id)