473,748 Members | 3,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview delete logic problem - Can anyone figure out what's wrong?

I have a gridview which uses an objectdatasourc e for its select and
delete.

The delete command uses the function below. The delete itself works but
the extra logic which requires parameters AccountDebitID and
AccountCreditID does not work.

'Delete a transaction

Sub deletetrans(ByV al transactionid As Integer, ByVal transactionamou nt
As Integer, ByVal AccountDebitID As Integer, ByVal AccountCreditID As
Integer)

Dim deleteaccounts As New trans
deleteaccounts. AddToAccountBal ance(AccountCre ditID,
transactionamou nt)
deleteaccounts. SubToAccountBal ance(AccountDeb itID,
transactionamou nt)

Dim transdel As New
transacsTableAd apters.Transact ionsTableAdapte r
transdel.Delete Transaction(tra nsactionid)

End Sub
The function works perfectly fine when I use it indpendently of the
gridview. But within the gridview it gives the error:

"There is no row at position 0." which is due to the value of the
AccountCreditID and AccountDebitID not being correctly passed on to the
function. So the problem lies somewhere in the gridview, but I can't
figure out what I am doing wrong.

The source for my objectdatasourc e and gridview is as follows:

<form id="form1" runat="server">
<div>
<asp:ObjectData Source ID="ObjectDataS ource1" runat="server"
DeleteMethod="d eletetrans"
SelectMethod="d isplaylast10tra ns" TypeName="trans ">
<DeleteParamete rs>
<asp:Paramete r Name="transacti onid" Type="Int32" />
<asp:Paramete r Name="transacti onamount" Type="Int32" />
<asp:Paramete r Name="AccountDe bitID" Type="Int32" />
<asp:Paramete r Name="AccountCr editID" Type="Int32" />
</DeleteParameter s>
</asp:ObjectDataS ource>
<br />
<asp:GridView ID="GridView1" runat="server"
DataSourceID="O bjectDataSource 1" DataKeyNames="t ransactionid">
<Columns>
<asp:CommandFie ld ShowDeleteButto n="True"
ShowEditButton= "True" />
</Columns>
</asp:GridView>
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label></div>
</form>

Can anyone figure out what I am doing wrong? Why aren't the values of
AccountDebitID and AccountCreditID being passed on to the delete
function?

Thank you,

Steve.

Sep 25 '06 #1
0 2662

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

Similar topics

3
13750
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should always confirm a delete action. There is also a consensus that the best way to do this is a template...
4
2603
by: Wannabe | last post by:
I am using ASP.Net 2.0 and have a gridview on my page. I have everything working except the delete command. The page reloads except the row I am trying to delete is still there. I believe it is something really easy, but I cannot see it. The stored procedue works when run in QA. Can someone tell me what I am doing wrong/missing that is keeping the delete command from working in the gridview? Thank you. I am trying to delete a row out of...
0
1244
by: Wannabe | last post by:
I have been trying to figure this out for days now...can someone please help? I am using ASP.Net 2.0 and have a gridview on my page. I have everything working except the delete command. The page reloads except the row I am trying to delete is still there. I believe it is something really easy, but I cannot see it. The stored procedue works when run in QA. Can someone tell me what I am doing wrong/missing that is keeping the delete...
1
8579
by: Barry L. Camp | last post by:
Hi all, Wondering if someone can help with a nagging problem I am having using a GridView and an ObjectDataSource. I have a simple situation where I am trying to delete a row from a table, but it doesn't seem to work at all. Below is my ASP.NET page, and further below, my VB.NET method that I am trying to call: <div id="admin-faq" class="page"> <h2>Site FAQs (Frequently Asked Questions)</h2>
5
2656
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are simply working with objects in memory. So, it appears as though Microsoft requires that our datamapper classes reside inside a folder called "App_Code", and NO WHERE ELSE. So, has anyone successfully been able to place their datamappers in a...
7
17317
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi all! I have a gridview inside a datagrid (nested) for which (gridview) the rowcommand is not raised in order to delete a row from the grid! I also tried OnRowCommand="method", didn't work either! Does anyone know how can I make this work? Thanks in advance!
0
2009
by: johnmott | last post by:
Hi all, One of the limitations of the GridView control is that the built-in delete processing doesn't prompt for confirmation -- something thats very important for a user interface. True, you can add server side logic for this, but its much more reassuring to have a Javascript confirmation window open up and prompt. There are several techniques for doing this, just google 'Gridview delete confirm' to see them. I've figured out one which...
11
4079
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved, CrtdUser and Date And Edit and Delete buttons
1
2990
by: Leon Mayne | last post by:
Hello, I have a gridview that's bound to a generic list of business objects and am using the RowCommand event to capture user clicks on actions. This was working fine up until today, but now e.CommandArgument being passed into the RowCommand event handler is always coming back as an empty string and causing an invalid cast exception. The GridView itself has a hyperlink field to display the object name, and several TemplateFields to...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
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
8242
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
6796
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
6074
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
4602
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...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
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.