Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Trick for unique row id when binding

Reply
Thread Tools

Trick for unique row id when binding

 
 
Karl Seguin
Guest
Posts: n/a
 
      10-27-2004
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
--
MY ASP.Net tutorials
http://www.openmymind.net/



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a unique method in python to unique a list? Token Type Python 9 09-09-2012 02:13 PM
list question... unique values in all possible unique spots ToshiBoy Python 6 08-12-2008 05:01 AM
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 PM
Magic Trick Datagrid Delete Row =?Utf-8?B?U2hhd24=?= ASP .Net 3 04-06-2005 06:35 PM
Unique Integer Types -- a useful C++ trick Christopher Brian Colohan C++ 2 11-19-2004 09:27 PM



Advertisments