Velocity Reviews - Computer Hardware Reviews

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

Thread Tools

Trick for unique row id when binding

Karl Seguin
Posts: n/a
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:

<tr id='<%# "Row_" + Container.IndexIndex%>'>

Which will give each tr an unique id without having to use a counter or the
OnItemDataBound...note that the first row is = 0

MY ASP.Net tutorials

Reply With Quote

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