bind a two-dimensional array to a repeater - error

Posted by Cristian Boariu on Stack Overflow See other posts from Stack Overflow or by Cristian Boariu
Published on 2010-04-06T19:06:45Z Indexed on 2010/04/06 19:33 UTC
Read the original article Hit count: 245

Filed under:
|

Hi, I have this array:

string[,] productData = new string[5,7];

I bind it to a repeater and a call a method like:

<img src="<%# getPhoto1WithReplace(Container.ItemIndex) %>"

which is defined like:

public String getPhoto1WithReplace(Object itemIndex)
{
    int intItemIndex = Int32.Parse(itemIndex.ToString());
    if (productData[intItemIndex, 3] != null)
        return this.ResolveUrl(productData[intItemIndex, 3].ToString());
    else return String.Empty;
}

I do not understand why it calls getPhoto1WithReplace with itemIndex as 5. My array has 5 indexes: 0,1,2,3,4, so HOW Container.ItemIndex can be 5...?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#