how to databind a datalist's page index to a button's commandname?

Posted by korben on Stack Overflow See other posts from Stack Overflow or by korben
Published on 2010-05-21T17:55:26Z Indexed on 2010/05/21 18:00 UTC
Read the original article Hit count: 170

Filed under:
|
|

i got this inside a button inside a datalist

CommandName="<%# Container.ItemIndex %>"

when i click the button, i'm expecting commandname to = 0, then 1, then 2, etc, as the datalist progresses, and i'm using that value in the button click's c#

but i'm getting this error, i'm pretty sure i'm using this exact setup on another page and i have no problems, any idea what's going on?

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0117: 'System.Web.UI.Control' does not contain a definition for 'ItemIndex'

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#