We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Repeater (Index 2 is not non-negative error)

I have a repeater custom control, and sometimes i get a ''System.IndexOutOfRangeException''. With this Index 2 is not non-negative and below total rows count. There are 2 cells still in the grid so i don''t know what''s going wrong.

3 Replies

BH Bernard Herrok December 1, 2004 03:09 AM UTC

the error points to this function: ''helper method that maps grid''s row index to a DataRowView Private Function GetDataRowView(ByVal rowIndex As Integer) As DataRowView Return CType(Me.Grid.Model.TableStyle.DataSource, DataView)((rowIndex - 1)) End Function ''GetDataRowView

AD Administrator Syncfusion Team December 1, 2004 11:40 AM UTC

Are there any other exceptions shown in the output window before you see this one? Can you modify our repeater sample to show this problem? If so, we can try to suggest a work-around. Worse case, you can put a check into that code to see if the index is valid. If not, you could try returning nothing or some valid value depending upon your needs.

BH Bernard Herrok December 1, 2004 07:19 PM UTC

i think this function is important to return something though. it looks like it returns the index of datarow according to the cell index. it calls UserControlSetValues passing in the index. if no index, then it won''t know which row to populate the cells with.

Live Chat Icon For mobile
Up arrow icon