Dynamic ID's for HTML ELements -
lets in aspx page have loop , within loop want create elements. how can generate id 's dynamically them.
for instance if have :
<div> <% foreach (item in itemcollection) { %> { <table> <tr> here want create td elements id recontext1 recontext2...the numbers @ end incrementing index. </tr> </table> } </div>
you use for
loop index or separate index variable foreach
:
<% int = 1; %> <% foreach (item in itemcollection) { %> <tr> <td id="recontext<%= %>">...</td> </tr> <% i++; %> <% } %>
Comments
Post a Comment