AJAX + DetailsView + CSS Adapters = Fail

Last post 05-04-2007 12:14 PM by hotfirewire. 3 replies.

Sort Posts:

  • AJAX + DetailsView + CSS Adapters = Fail

    05-04-2007, 9:06 AM
    • Member
      11 point Member
    • hotfirewire
    • Member since 07-11-2002, 7:09 AM
    • Toronto
    • Posts 14

    Hello,  I get this error when I try to do an insert on a DetailsView.   Any Suggestions?   Thanks, Lee

     

    Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index

    Source Error:

    Line 94:                         Dim row As DetailsViewRow = ControlAsDetailsView.Rows(iRow)
    Line 95: 
    Line 96:                         If ((Not ControlAsDetailsView.AutoGenerateRows) AndAlso _
    Line 97:                                 ((row.RowState And DataControlRowState.Insert) = DataControlRowState.Insert) AndAlso _
    Line 98:                                 (Not ControlAsDetailsView.Fields.Item(row.RowIndex).InsertVisible)) Then

    Source File: \App_Code\Adapters\DetailsViewAdapter.vb    Line: 96

  • Re: AJAX + DetailsView + CSS Adapters = Fail

    05-04-2007, 10:29 AM
    Answer
    • Member
      11 point Member
    • hotfirewire
    • Member since 07-11-2002, 7:09 AM
    • Toronto
    • Posts 14

    Ok so I've figured out how to fix this issue.  It seems to be when you do an insert and your DetailsView has auto generated buttons it fails. 

    Basicly the statement was failing when it hit the auto generated rows. 

    FIX: I've added the following to my code (replace line 96 to 100 in \App_Code\Adapters\DetailsViewAdapter.vb)

     If ((Not ControlAsDetailsView.AutoGenerateEditButton) AndAlso _

    (Not ControlAsDetailsView.AutoGenerateInsertButton) AndAlso _

    (Not ControlAsDetailsView.AutoGenerateDeleteButton)) Then

    If ((Not ControlAsDetailsView.AutoGenerateRows) AndAlso _

    ((row.RowState

    And DataControlRowState.Insert) = DataControlRowState.Insert) AndAlso _

    (

    Not ControlAsDetailsView.Fields.Item(row.RowIndex).InsertVisible)) Then

    Continue For

    End If

    End If
  • Re: AJAX + DetailsView + CSS Adapters = Fail

    05-04-2007, 10:36 AM
    • Member
      435 point Member
    • bdemarzo
    • Member since 07-02-2002, 8:05 AM
    • New York
    • Posts 168

    Can you create an issue with your code fix on the Codeplex project site at http://www.codeplex.com/cssfriendly/WorkItem/AdvancedList.aspx?

    We will then review and incorporate your fix into the community code release. 

  • Re: AJAX + DetailsView + CSS Adapters = Fail

    05-04-2007, 12:14 PM
    • Member
      11 point Member
    • hotfirewire
    • Member since 07-11-2002, 7:09 AM
    • Toronto
    • Posts 14

     

     Done, you can now view the issue here http://www.codeplex.com/cssfriendly/WorkItem/View.aspx?WorkItemId=1976

     

     

Page 1 of 1 (4 items)