473,803 Members | 3,166 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 2320
"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
4718
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
2615
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
4640
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
1930
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
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9565
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
10550
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
10317
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
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9125
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...
0
6844
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
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.