This is a migrated thread and some comments may be shown as answers.

Radgrid Inplace-Editing Error: "System.ArgumentOutOfRangeException: The specified argument is out of range; Argument name: index"

5 Answers 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 14 Oct 2010, 02:42 PM
Hello!

I get the following error when double clicking on the grid row or clicking the edit button in the row, which I want to edit in place:

System.ArgumentOutOfRangeException: The specified argument is out of range
Argument name: index

It is not an ajax failure, because it also happens out of a update panel. My code is inspired from the demo here: http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx

My code looks like this (the "important" part):

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  
                                        <script type="text/javascript">
  
                                             function RowDblClick(sender, eventArgs)
                                             {
                                                 sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
                                             }
                                               
                                        </script>
  
                                    </telerik:RadCodeBlock>
                                    <telerik:RadGrid ID="rgKalkulation" runat="server" AutoGenerateEditColumn="false"
                                        AutoGenerateDeleteColumn="false" OnNeedDataSource="rgKalkulation_NeedDataSource"
                                        AllowAutomaticDeletes="True" AllowAutomaticInserts="True" PageSize="10" AllowAutomaticUpdates="True"
                                        OnDeleteCommand="rgKalkulation_DeleteCommand" OnInsertCommand="rgKalkulation_InsertCommand"
                                        OnUpdateCommand="rgKalkulation_UpdateCommand" OnItemDataBound="rgKalkulation_OnItemDataBound">
                                        <MasterTableView CommandItemSettings-RefreshText="" CommandItemDisplay="Bottom" AutoGenerateColumns="false"
                                            Font-Size="8pt" Font-Names="Verdana" runat="server" NoMasterRecordsText="Keine Datensätze vorhanden."
                                            InsertItemDisplay="Bottom" CommandItemSettings-AddNewRecordText="Datensatz hinzufügen"
                                            EditMode="InPlace" ShowGroupFooter="true" DataKeyNames="id">
                                            <GroupByExpressions>
                                                <telerik:GridGroupByExpression>
                                                    <SelectFields>
                                                        <telerik:GridGroupByField HeaderText="Art.-Gr." FieldName="artgrkopf"></telerik:GridGroupByField>
                                                    </SelectFields>
                                                    <GroupByFields>
                                                        <telerik:GridGroupByField FieldName="artgr" SortOrder="Ascending"></telerik:GridGroupByField>
                                                    </GroupByFields>
                                                </telerik:GridGroupByExpression>
                                            </GroupByExpressions>
                                            <Columns>
                                                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                                                    <ItemStyle CssClass="MyImageButton" />
                                                </telerik:GridEditCommandColumn>
                                                <telerik:GridBoundColumn DataField="artgr" HeaderText="ArtGr" UniqueName="artgr"
                                                    Visible="false">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="artbzl" HeaderText="Artikelbezeichnung" DefaultInsertValue=""
                                                    UniqueName="artbzl" FooterText="Anzahl Artikel" Aggregate="Count">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="herstellerbezeichnung" HeaderText="Herstellerbezeichnung"
                                                    DefaultInsertValue="" UniqueName="herstellerbezeichnung">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="artext" HeaderText="Art.-Nr." DefaultInsertValue=""
                                                    UniqueName="artext">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="palettengewicht" HeaderText="Palettengewicht"
                                                    DefaultInsertValue="" UniqueName="palettengewicht">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="mdevsx" HeaderText="Inhalt" DefaultInsertValue=""
                                                    UniqueName="mdevsx">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridNumericColumn HeaderText="Absatz (to)" DataField="absatz" ColumnEditorID="GridNumericColumnEditor1" UniqueName="absatz">
                                                </telerik:GridNumericColumn>
                                                <telerik:GridNumericColumn HeaderText="Nettoumsatz (T€)">
                                                </telerik:GridNumericColumn>
                                                <telerik:GridNumericColumn HeaderText="Bruttoerlös (alt)">
                                                </telerik:GridNumericColumn>
                                                <telerik:GridNumericColumn HeaderText="Nettoerlös (alt)">
                                                </telerik:GridNumericColumn>
                                                <telerik:GridNumericColumn HeaderText="Bruttoerlös (neu)">
                                                </telerik:GridNumericColumn>
                                            </Columns>
                                        </MasterTableView>
                                        <ClientSettings>
                                            <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="650px" />
                                            <ClientEvents OnRowDblClick="RowDblClick" />
                                        </ClientSettings>
                                    </telerik:RadGrid>
                                    <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server">
                                    </telerik:GridNumericColumnEditor>


I need (quick) help please, because tomorrow I have a meeting where I have to present this.

Kind regards

Michael

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 18 Oct 2010, 05:39 PM
Hello Michael,

I reviewed the provided code, and it looks correct. However, in order to properly assist you, I would suggest that you open a formal support ticket and send us a small working project, which demonstrates the problem you are facing. We will review it locally, and advise you further.

Sincerely yours,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 19 Oct 2010, 08:28 AM
Hello Pavlina!

Today I coded a little sample project. And what a suprise: it works without error!?!?!?

So I decided to examine my code again. I deleted the most columns in the grid and then it worked. After that I added the deleted the columns column by column. And then I got the error again! The error occurs, when I want to get to the edit mode and there are columns in the grid, that don't have a datafield bounded to them and also no columneditor referenced.

I am new to radgrid editing. Since last week, I just used it to display data. Sometimes the solution is closer then expected.

Kind regards

Michael
0
Pavlina
Telerik team
answered on 19 Oct 2010, 12:45 PM
Hello Michael,

Can you please verify that the proper index of grid record is passed on delete command? The exception you receive might be due to attempt to delete record from the underlying data source for item which do not exist or with invalid index.

Greetings,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 19 Oct 2010, 01:18 PM
Hello Pavlina!

I think you missunderstand me. I found out the problem. The problem was that there were columns with no datafield and no columneditor set. Till then I never did or wanted to do something with deleting.

But perhaps you can give me an adivse for the following situation:

Meanwhile I have added FrozenColumnCount to my grid. The problem is that the frozen columns do not freeze on initial page_load???
When I go for edit mode (Ajax Postback) the set columns freeze correct (also after canceling edit mode).

Also please look at my other thread: Link

Kind regards

Michael
0
Pavlina
Telerik team
answered on 22 Oct 2010, 01:10 PM
Hello Michael,

If the issues persist, please open a formal support ticket and attach a sample project demonstrating the problem. We will debug it locally and get back to you with our findings.

Looking forward for your reply.

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Michael
Top achievements
Rank 1
Share this question
or