Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2007, 11:08 PM
Authorized User
 
Join Date: Oct 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default Deleting record from Datagird with Delete Button

Hi All,

I hope you can help me out with the problem in my application. I have a datagrid with a DELETE button. The datagrid has the following columns: DELETE ProjectName

The DELETE column is a button column to delete records. The Projectname column is a Hyperlink column that redirects to another page. The Hyperlink column uses ProjectID as the URL Field. When DELETE button is clicked, I would want to get the ProjectID of the ProjectName being clicked. THis ProjectID will be used as a parameter of a stored proc to delete the record from the database. When I tried using the code below:

DeleteFromDatabase(dgrdUsers.DataKeys(CInt(e.Item. ItemIndex)))

DeleteFromDatabase is a function that requires ProjectID as parameter to delete a record from the database. I always get this error :
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

What's odd is, I have an application that uses the same solution and the code works. I dont know what's causing the eror in my new application. I even tried copying and including the form of the other application and put it in my current project. When I did that, the app also returns the same error. It's really weird! The form works in the older app, but when I copied it to the new app, the error "index was out of range....." was thrown!

Thanks in advance!!


 
Old May 1st, 2007, 03:27 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Can you post the code you are using to bind the datagrid as well as include any other bits relating to the datagrid?

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
php/mysql delete button and delete query dungey PHP Databases 17 April 11th, 2009 12:24 PM
Deleting a record from a subform captainlove Access VBA 3 May 1st, 2008 11:38 AM
Problems deleting a record donrafeal Access VBA 0 January 18th, 2007 06:19 PM
Deleting All Record In A Table McDiddy Access VBA 3 January 10th, 2007 09:20 AM
Deleting A Record sirmilt BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 July 31st, 2006 07:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.