473,789 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deleting row from GridView causes ArgumentOutOfRa ngeException during System.Web.UI.W ebControls.Grid *View.set_Selec tedIndex(Int32 value)

Hi All,

I am using Link Button for DELETE on the gridview. When I click on
DELETE link, I get the ArgumentOutOfRa ngeException. But...it deletes
the record from table in the database.
On Gridview_rowdat abound, I am dynamically building hyperlink control
based on the values in the other fields. Here is my code for
Gridview_rowdat abound. It does work sometimes though.
Protected Sub dgQuestions_Row DataBound(ByVal sender As Object, ByVal e

As System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles
dgQuestions.Row DataBound
If e.Row.RowType = DataControlRowT ype.DataRow Then
Dim hLnk As HyperLink = CType(e.Row.Cel ls(3).Controls( 0),
HyperLink)
Dim iCID As String
iCID = drpClasses.Sele ctedValue
Dim iQSeq As Integer
iQ = cint(e.Row.Cell s(1).Text)
hLnk.NavigateUr l = "ShowDetails.as px?CID=" & iCID
End If
End Sub
Please, see Stack Trace below. Any ideas anyone?
Stack Trace:
[ArgumentOutOfRa ngeException: Specified argument was out of the range
of valid values.
Parameter name: value]
System.Web.UI.W ebControls.Grid View.set_Select edIndex(Int32 value)
+1454311
System.Web.UI.W ebControls.Grid View.HandleDele teCallback(Int3 2
affectedRows, Exception ex) +354
System.Web.UI.D ataSourceView.D elete(IDictiona ry keys, IDictionary
oldValues, DataSourceViewO perationCallbac k callback) +123
System.Web.UI.W ebControls.Grid View.HandleDele te(GridViewRow row,
Int32 rowIndex) +927
System.Web.UI.W ebControls.Grid View.HandleEven t(EventArgs e, Boolean
causesValidatio n, String validationGroup ) +1155
System.Web.UI.W ebControls.Grid View.OnBubbleEv ent(Object source,
EventArgs e) +95
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args) +35
System.Web.UI.W ebControls.Grid ViewRow.OnBubbl eEvent(Object source,
EventArgs e) +117
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args) +35
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e)
+115
System.Web.UI.W ebControls.Link Button.RaisePos tBackEvent(Stri ng
eventArgument) +163
System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra *isePostBackEve nt(String

eventArgument) +7
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
+174
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
+5102

Jun 29 '06 #1
1 2319
"loga123" <vd**********@c ovansys.com>'s wild thoughts were
released on 29 Jun 2006 09:58:26 -0700 bearing the following
fruit:
>Hi All,

I am using Link Button for DELETE on the gridview. When I click on
DELETE link, I get the ArgumentOutOfRa ngeException. But...it deletes
the record from table in the database.
On Gridview_rowdat abound, I am dynamically building hyperlink control
based on the values in the other fields. Here is my code for
Gridview_rowda tabound. It does work sometimes though.
Protected Sub dgQuestions_Row DataBound(ByVal sender As Object, ByVal e

As System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles
dgQuestions.Ro wDataBound
If e.Row.RowType = DataControlRowT ype.DataRow Then
Dim hLnk As HyperLink = CType(e.Row.Cel ls(3).Controls( 0),
HyperLink)
Dim iCID As String
iCID = drpClasses.Sele ctedValue
Dim iQSeq As Integer
iQ = cint(e.Row.Cell s(1).Text)
hLnk.NavigateUr l = "ShowDetails.as px?CID=" & iCID
End If
End Sub
Is that your real code?

Because you declare 'iQSeq' but us 'iQ'
Jan Hyde (VB MVP)

--
Why don't boxers have sex before a fight?

Because they don't fancy each other.

Jul 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3472
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On Gridview_rowdatabound, I am dynamically building hyperlink control based on the values in the other fields. Here is my code for Gridview_rowdatabound. It does work sometimes though.
0
1802
by: Kondapanaidu | last post by:
Hi, I am using Visual Studio 2005 ASP.NET Using C#. My form has one. Grid view This it self having Text box and Dropdowns. I Have coule of questions like?
12
4714
by: brwalias | last post by:
Hi, using .net 2 sql server 2005 Here is my situation: I'm passing a variable in the url from a selection on Page A and need to display the results on the Results page be based on that variable in the url. I would like that variable to trigger a stored and
1
2614
by: =?Utf-8?B?TG95b2xhIHN0YWxpbg==?= | last post by:
Hi, I am using ASP.Net 2.0 version and Windows'XP OS. I am useing the Grid view control to display the user details along with the paging concept provided by the grid view control. When i click the paging link (2,3,4.. ) it produces the result properly, But my problem is when i tried to press the Refresh button in the explorer, it throws the following popup alert message
0
1266
by: hellboss | last post by:
Hi ! Im using Asp.net vs05, rite now iam working with a grid view where i map the column values from a database to the Button Field's DataTextfield, example "Empno" , The problem is that ! after i map the DataTextField value, i want the value in the button field to be displayed in a msg box when the corresponding Button is clicked . Kindly provide with a valid soultion ! Thanks in Advance !
1
4635
by: vibhashin | last post by:
I hve extracted a coloumn in combo box from database. I want that when i select a particular value from the combo box it should display the related details of the selected value in the combo box in the data grid view from the database.
1
1650
by: eranby | last post by:
hi, I'm using access db in my c# program I have a select query and I want to present the result in data grid view ,I succeed doing that with this while loop int i = 0,j=0; while (dbReader.Read()) { dataGridView2.Rows.Add(); dataGridView2.Value = (string) .Value = (string)dbReader.GetValue(1); j++; dataGridView2.Value = (string)dbReader.GetValue(2);
2
4152
by: eranby | last post by:
hi, I'm using access db in my c# program I have a select query and I want to present the result in data grid view ,I succeed doing that with this while loop Code: ( c ) int i = 0,j=0; while (dbReader.Read()) { dataGridView2.Rows.Add();
1
1927
by: John | last post by:
Hi I have a grid view bound to an SqlDataSource. One of the fields in grid view is a hyperlink field. How can I set the hyperlink field's navigationurl to the value of a field coming form the underlying SqlDataSource? Thanks Regards
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10412
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3703
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.