K
Karl Seguin
I just discovered this and I'm sure I'm not the first, but it can be useful
so thought I'd post it. If you need a unique Id when binding, you can
simply use <%# Container.ItemIndex %>. For example, if you are doing some
javascript, you can do something like:
<itemTemplate>
<tr id='<%# "Row_" + Container.IndexIndex%>'>
<td>...</td>
<td>...</td>
</tr>
</itemTemplate>
Which will give each tr an unique id without having to use a counter or the
OnItemDataBound...note that the first row is = 0
Karl
so thought I'd post it. If you need a unique Id when binding, you can
simply use <%# Container.ItemIndex %>. For example, if you are doing some
javascript, you can do something like:
<itemTemplate>
<tr id='<%# "Row_" + Container.IndexIndex%>'>
<td>...</td>
<td>...</td>
</tr>
</itemTemplate>
Which will give each tr an unique id without having to use a counter or the
OnItemDataBound...note that the first row is = 0
Karl