Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

How can I find the ItemIndex in a ListView?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aleko - 19 Mar 2008 19:20 GMT
Hi,

I was in the middle of converting some old Repeater code to use a
ListView, when I discovered that the ListViewItem class doesn't have
an ItemIndex property. Is there another way of getting the index of
the current list item?

Thanks,

Aleko
Alexey Smirnov - 19 Mar 2008 21:41 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> Aleko

When ListView is clicked the ItemCommand() event is raised and a
ListViewCommandEventArgs object is passed, which can be used to
retrieve control values such as an index of the current row.

protected void ListView1_ItemCommand(object sender,
ListViewCommandEventArgs e)
{
... (ListViewDataItem)e.Item.DisplayIndex

See more:

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.listviewcomma
ndeventargs.aspx

http://msdn2.microsoft.com/en-us/library/bb398790.aspx
aleko - 22 Mar 2008 02:14 GMT
> > Hi,
>
[quoted text clipped - 19 lines]
>
> http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.li...http://m
sdn2.microsoft.com/en-us/library/bb398790.aspx

Ah, it's called DisplayIndex. Thanks very much!

-Aleko

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.