473,498 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help in my VB Code .. to Delete

hi,

I have been trying to solve this problem since morning, and haven't really come up with a solution. it is frustrating. please help.

i have a datagrid and got a delete column

<asp:datagrid id="dgdocument" runat="server" AutoGenerateColumns="False" EnableViewState="True" OnDeleteCommand="DeleteCommand">
<Columns>
<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
<asp:BoundColumn DataField="Param1" HeaderText="Param1"></asp:BoundColumn>
<asp:BoundColumn DataField="Param2" HeaderText="Param2"></asp:BoundColumn>
<asp:BoundColumn DataField="Param3" HeaderText="Param3"></asp:BoundColumn>
</Columns>
</asp:datagrid>


and the VB code is

Sub DeleteCommand(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
Dim deletekey = dgdocument.DataKeys(CInt(E.Item.ItemIndex))
Response.Write(deletekey)

'load the XML
Dim doc As New XmlDocument()
doc.Load("c:\Inetpub\wwwroot\Cashier\cashier.xml")
Dim onode As XmlElement = doc.SelectSingleNode("cashier/tag[@section='workinformation-" & lbunique.Text & "' and @param1='& deletekey & ' ]")

'not to sure whether this is right
Dim oldNode As XmlNode = doc.RemoveChild("cashier/tag[@section='workinformation-" & lbunique.Text & "' and @param1='& deletekey & ' ]")

' ---------------- this is not right : deleting the node
onode.RemoveChild(oldNode)

' save the xml
doc.Save("c:\Inetpub\wwwroot\Cashier\cashier.xml")

dgdocument.EditItemIndex = -1
viewxmldtn()
End Sub

and the XML file is

<cashier>
<tag section="work-14" param1="1" param2="345" param3="7/9/2003 08:00 AM" />
<tag section="work-14" param1="2" param2="345" param3="7/9/2003 08:00 AM" />
<tag section="work-14" param1="3" param2="345" param3="7/9/2003 08:00 AM" />
</cashier>
Param1 is a unique field.
What should the right syntax be to remove the node from the XML file.

Any help is appreciated.

Thank You
--
Thank You,
Sean
Nov 19 '05 #1
0 1018

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

Similar topics

4
3834
by: Greg Baker | last post by:
I don't know what standard protocol is in this newsgroup. Am I allowed to post code and ask for help? I hope so.. :) Here's my problem: I am trying problem 127 of the valladolid online...
1
5044
by: cheezebeetle | last post by:
ok, so I am having problems passing in an ASPX function into the Javascript in the codebehind page. I am simply using a confirm call which when they press "OK" they call this ASPX function, when...
23
8904
by: da Vinci | last post by:
Greetings, Onwards with the school studying. Working on a program and need to delete a file from a known location on the hard drive but cannot get anything I do to work. I have tried to use...
5
2120
by: xuatla | last post by:
Hi, I encountered the following compile error of c++ and hope to get your help. test2.cpp: In member function `CTest CTest::operator+=(CTest&)': test2.cpp:79: error: no match for 'operator='...
7
2361
by: Alan Bashy | last post by:
Please, guys, In need help with this. It is due in the next week. Please, help me to implement the functions in this programm especially the first three constructor. I need them guys. Please, help...
7
1793
by: Christian Christmann | last post by:
Hi, in the past I always appreciated your help and hope that you also can help me this time. I've spent many many hours but still can't solve the problem by myself and you are my last hope. ...
4
2114
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
7
2472
by: Dynamo | last post by:
I am using values stored an $_POST array to display records from a table before asking the user if he is sure he wants to delete them. If the user confirms then the records are deleted. Without...
0
4102
by: hagar | last post by:
Hi all, I have a problem which I can not understand why this is happening! Debugging this I actually see that it grabs first record then when stepping through code to the line rsImportTo.AddNew...
3
1910
by: Matthew Warren | last post by:
I have the following piece of code, taken from a bigger module, that even as I was writing I _knew_ there were better ways of doing it, using a parser or somesuch at least, but learning how wasn't...
0
7125
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,...
0
7002
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...
0
7203
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...
0
7379
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...
0
5462
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,...
1
4908
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...
0
4588
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...
0
3093
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...
1
656
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.