Specified argument was out of the range of valid values. Parameter name: value

I am having a very difficult issue to resolve with this one.

I have a GridView where I have set AutoGenerateDeleteButton to true, and I have a delete query in my DataSource.

The delete query is actually a Stored Procedure.

Within that stored procedure I initially just deleted the row and also deleted some related records, and also updated a related record with a timestamp.

That all worked just fine.

However, I then added a Cursor to the Stored Procedure that goes through all of the records in a given set and renumbers them after the delete.

After adding this Cursor to the Stored Procedure, I now get the error: "Specified argument was out of the range of valid values. Parameter name: value" when I press the delete button on the GridView.

What makes this all the more difficult to diagnose is that the error appears to be handled, so I'm just getting a dialog box, I'm not getting the full stack trace and everything, and I can't figure out when the error is even occuring. I know that it happens some time after the _RowDeleted event of the GridView.

I put a breakpoint in _RowDeleted, and I can see there from the watches that there is no exception being returned from the delete event. So, when I check e.Exception in _RowDeleted it is null, so there is no error comign back from the delete operation.

I can't figure why it would make any differece that the Cursor runs or doesn't run in terms of generating this error. The Cursor is renumbering a field that is displayed in the Grid, but I dont' see why that should be any problem, since the Grid should simply be requerying the data after the delete.

Furthermore, when I run a SQL Trace (Query Profiler) there are no requests to the database after the delete. The delete SP is the last thing that runs, there are no other querys run, and then I get the error. Also, the _RowDataBound event is never called either, so somewhere between _RowDeleted and _RowDataBound this error crops up, and I have no idea why, and I have no idea how the Cursor in the Stored Procedure can be causing it.

0
malachi151
12/19/2007 5:39:09 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

5 Replies
598 Views

Similar Articles

[PageSpeed] 14

Your datasource has quite a bit of code associated with it.  We don't see that code, because it is generated for us when the application starts to run.  It sounds to me like what is happening is, after your delete occurs, the application is trying to reconcile the rows in your gridview with the data from the server.  Everything goes fine until you get past the one you just deleted.  Are you setting datakeys? If not, the datasource is determining the unique key from the data.  So it happily matches up keys until it hits the ones you have renumbered.  Maybe even the one for the last row if you do the renumbering each time.  I think it expects that the only thing that happened is that the row it deleted is gone. Consider calling databind in the rowdeleted event.

--JJ


Please mark as answered if I helped.
I don't answer personal emails unless I know you or of you. Feel free to post in the forum to get an answer from me.
0
jose_jimenez
12/19/2007 6:22:29 PM

Yes, I tried calling DataBind in the _RowDeleted event, but that's didn't resolve it.

The first step is that I need to see which line of code is causing the problem, but I can't even figure that out. I have eliminated all of the catch statements on the whole page, but it still acts like a trapped error, I'm not getting the page that you normally, get, just a dialog box.

I do have a DataKeyName set on the Grid, but the field that is being renumbered is not the DataKey.

I have also tried just deleting the last row, which still calls the renumbering, but in effect it does nothing because the renumbered numbers are the same as prior to the renumbering algorithm, so I was surprised to see that it fails with this as well, which makes me think that its not the changing of the fields itself.

 

0
malachi151
12/19/2007 6:47:13 PM

Well, once again I've solved my own issue, sort of, at least I've found a work around anyway.

In my stored procedure I set NOCOUNT ON and that stops the issue.

What I don't understand about this is that without using NOCOUNT and without the Cursor the SP still affects 3 rows.

With the Cursor, and on the small test set I'm using, it affects 5 rows.

I could understand if it only affected 1 row and that worked and then when it affected 5 rows it didn't work, but it works when it affects 3 rows also, which it does without the Cursor.

Also, during the _RowDeleted event I set e.ErrorsHandled to true just in case, and that didn't resolve it either.

Anyway, using NOCOUNT in my SP prevents the problem, though I don't consider it a true fix, because I never figured out how to handle the issue in code, I just avoided it in SQL.

 

0
malachi151
12/19/2007 6:58:32 PM

I'm sorry if I wasn't clear.  Because you are not writing the code to contact your server and populate the data in your gridview, you can't see the line of code that is causing the problem.  In essence the line of code doesn't exist because you didn't write it.  It is happening in a piece of code that was autogenerated when you decided to use the provided datasource control.  There are ways to get at the code, but I'm not exactly clear yet on how to do that.  If you want to see what line of code / what process is causing the problem, you will need to write the data access code yourself. 

This doesn't mean that you should not use the datasource control, or that there is something inherently wrong with it. 

if you wrote your own data access code, i think you wouldn't have the problem.

 


Please mark as answered if I helped.
I don't answer personal emails unless I know you or of you. Feel free to post in the forum to get an answer from me.
0
jose_jimenez
12/19/2007 7:02:45 PM

Thanks Jose, I think you are right, but at this point I'll probably just accept my work around and move on.

Thanks

0
malachi151
12/19/2007 8:07:54 PM
Reply:

Similar Artilces:

specified argument was out of the range of valid values parameter name: value
 hello everyone, i need your help.. i have a gridview that has a delete button, this gridview is inside a parent gridview. my problem now is when i delete the row(the child griview will always contain one row only)  it gave me an error stating that the specified argument was out of range of valid values parameter name: value, after refreshing that's the only time the delete button will function correctly. what could be the possible reason for this, this error appears occasionally, i can't afford to have this error during our defense..please help....here is my code for delet...

Specified argument was out of range of valid values. Parameter name:Value
Hi Guru's,  Below is my problem. I have a user control, in which I have a ajax tab control. At design time I just have the tabcontainer and depending on the id passed to the control I am generating the contents for the tab's. Basically each of the tab contains a list of items for each item a series of option buttons are presented to mark the score.  I have set eanable view state to false for tab and all the dynamically generated radio buttons and checkbox's, and enabled autopostback to ture, when I click on any of radio button, checkbox or image b...

(Urgent) specified argument was out of the range of valid values. Parameter name: Value
Hi  i have a datagrid in a user control which has pagin and sorting enabled and the data loads fine.. I am calling this UserControl in a tab panel using Ajax.. But when I Try to sort and page in my tab Panel...i get an error saying  specified argument was out of the range of valid values. Parameter name: Value Hope u can help me solve it.. I am dynamically generating the Tabpanel and passing the valid values to load the user control.. but when i try to page and sort i get a popup with the above error.. Any help will be appreicated. Regards Karen Golden rule about ...

Error:
Can anyone help me, I am getting the following error whilst attempting to retrieve data from an Access DB: Specified argument was out of the range of valid values. Parameter name: value I receive this error from a method which uses a select statement to retrieve data into a datareader, and then I place the value of each of the columns into variables. I have another method before this one which is identical, except for the select statement, and it gives me no errors at all. Here is my code: 'create the connection string objects Dim connstr As String co...

critical error has occurred.Specified argument was out of the range of valid values. Parameter name: value
In Debug mode my cutome module is working well. After that i created a zip file to upload the module and also i deleted my tables and store procedures.When I upload my zip file there is no error, Table and All the storeprocedures are installed  in my database.I don't know what is the problem.The error message is this The problem could be that you did not set valid default values for you module settings.Have a look at this.Best regardsHans-PeterDNNPortal German DotNetNuke Community Thank you very muchI reolve that problem by setting the default settings.Now i have one more probl...

(urgent) How do i handle this error in tabs: ( specified argument was out of the range of valid values. Parameter name: Value)
Hi   My user control consisted of a datagrid and in that datagrid i was diplaying the plans for that particular user.. My user control consits of paging and sorting but when i click on those pages no and sort by column name i get and error in the form of an popup window but the pagin and the sorting is been handled by the User control...  specified argument was out of the range of valid values. Parameter name: Value   What should i do to solve it Regards KAren...

Specified argument was out of the range of valid values. Parameter name: Hour, Minute, and Second parameters describe an unrepresentable DateTime.
This error frequently occurs when run OleDbCommand.ExecuteReader to query data from Oracle database and then bind to the DataGrid. In sql select statement has no any datatype date column. I use Oracle Provider for OLE DB. Check out my post on storing dates in Oracle at http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=341221...

Error adding node
 I have a recordset that I loop thru adding nodes to my treeview.Well at around record # 123 out of 500 or so, I get this error adding child node :"Specified argument was out of the range of valid values.Parameter name: Index was out of range.  Must be non-negative and less than the size of the collection." The node I'm adding to exists, and I can't see anything wrong w/ the data -  and it always gets hung up on the same record.*And the same code has been used 122 times already w/out issue. *Any ideas ?  my code: 'lastDivisionIndex = 1'...

Specified argument was out of the range of valid values Parameter name: index
i'm having a weird problem that isn't reproducing itself on any of my other pages. i need to run an if/else in page_load, the if statement is the text value of a label in a datalist (if the label is null do this, if it's not do that) - my datalist and sqldatasource code looks like this:  <asp:DataList ID="DataList1" runat="server" DataSourceID="iplist"> <ItemTemplate> ip: <asp:Label ID="ipLabel" runat="server" Text='<%# Eval("ip&...

Specified argument was out of the range of valid values. Parameter name: index
This is the error I'm getting. I will paste my code below: " DeleteCommand="DELETE FROM [Friends] WHERE [FriendName] = @FriendName" SelectCommand="SELECT * FROM [Friends] WHERE (([FriendName] = @FriendName))" UpdateCommand="UPDATE [Friends] SET [UserName] = @UserName, [UserID] = @UserID, [IP] = @IP, [AddedOn] = @AddedOn, [FriendName] = @FriendName, [IsApproved] = @IsApproved WHERE [FriendID] = @FriendID"> ...

Specified argument was out of the range of valid values. Parameter name: options
when i  try running a  webform i got this error:Specified argument was out of the range of valid values. Parameter name: optionsi dont where the error originated since i didnt put any control on the page i just run a plain webform.. but during the page load the error occured..any help with thi??...thnks in advance guy i keep on  posting this thread but  no reply even one. Need to see the code....Zath i didnt wrote any code just a plain webform no control or whatever the stack trace error is this:  Server Error in '/first' Application. Specified argument wa...

Specified argument was out of the range of valid values. Parameter name: index
hi i wrote the following code: System.Web.UI.WebControls.Image z=new System.Web.UI.WebControls.Image(); z.Width=100; Table1.Rows[0].Cells[0].Controls.Add(c);and i get this error Specified argument was out of the range of valid values. Parameter name: index i guess its becuse the table size is not initialized, if so i cant find away to do it....does someone have an idea whats the problem?? thanks So the Table doesn't have any rows or cells added yet? If thatr's the case, you'd either put them declaratively there before indexing to the collections (in aspx) or add them dynamically&...

Specified argument was out of the range of valid values. Parameter name: index
I am getting an error on this statement within the code(below): Line 109: Dim UserID as TextBox = e.Item.Cells(1).Controls(0). I don't know if it has anything to do with that I am not updating the UserID at all. But I am not recieving the UserID anywhere except when the data is binded in the datagrid. The UserID is read only so it cannot be changed. I am just changing little things like the name, emailaddress. Any suggestions?? I am just trying to run a simple call to a datagrid where I can Edit, Update and Cancel the information in the grib. Thanks Sub Page_Load(sen...

Web resources about - Specified argument was out of the range of valid values. Parameter name: value - asp.net.presentation-controls

How Samsung's connected fridge is advancing the smart home
LAS VEGAS — The annual Consumer Electronics Show once again ushered in a class of new giant TVs (this year: HDR), cameras (4K, of course) and ...

Oculus Rift inventor apologises for price tag
Palmer Lucky apologies for earlier comments when he underestimated the price of the virtual reality headset, but still claims it is 'obscenely ...

Female Founders: The State Of The Union
Building a tech company from the ground up and having it succeed is an ambitious goal. Doing that as a female founder and CEO is another beast, ...

Alabama Chief Justice Says Ban On Same-Sex Marriages Still In Effect
Alabama Chief Justice Roy Moore's latest move against marriage equality is "sad & pathetic," Montgomery County Probate Judge Steven Reed tweeted ...

Kim Kardashian Wants Kylie Jenner To Stop Acting Like A Diva, Warns Her To Be ‘Perfect’ For Kanye West’s ...
Kim Kardashian had some stern words of advice for half-sibling Kylie Jenner in the preview for Sunday’s episode of Keeping Up with the Kardashians ...

Watch Netflix’s new trailers for ‘The Get Down’ and ‘The Crown’
If you thought Netflix had a busy year in 2015, just wait until you see what the streaming company has in store for 2016. Over the next 12 months, ...

Winners and losers from Hall of Fame election night
Ken Griffey Jr. sets a ballot record and is joined by Mike Piazza in the Hall of Fame's Class of 2016, but who were the other winners and losers? ...

CES 2016: World's first human-carrying drone is the closest we've come to a flying car
Personal mini helicopters that get us from A to B seem like a far away innovation of the future, but we might be closer than that. At CES 2016 ...

Congress sends health care repeal to Obama, setting up certain veto
CNN Congress sends health care repeal to Obama, setting up certain veto Miami Herald Congressional Republicans made good Wednesday on a central ...

ces 2016: Chevy introduces the production Bolt EV
GM took to the stage at CES 2016 to introduce the production 2017 Chevrolet Bolt, which brings 200-miles of all-electric driving to the masses. ...

Resources last updated: 1/7/2016 1:42:43 PM