473,326 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

XML FILE as datasource to Grid view..? not able to remove the nodes..?

I have created a XML file as datasource which i 'm binding to a grid view control.

During runtime I'm capturing items in XML file and displaying in a GRID VIEW control. but i want to remove or flush the XML file content on page load. I tried parentnode.removeall () but no use..

(1) how to clean/delete the XML file nodes on page load for using as DATA SOURCE which again i'm binding to Grid view..??

(2) and also on page refresh my gird duplicating the items from XML file...how to avoid duplication of items in Grid...?

----------------------------------------------------------------code on button click (save)

XmlDocument xdoc = new XmlDocument();

xdoc.Load(Server.MapPath("XMLFILES\\ReferrelGrid.x ml"));

XmlElement Parentnode = xdoc.CreateElement("ITEMS");

xdoc.DocumentElement.PrependChild(Parentnode);

XmlElement locationnode = xdoc.CreateElement("VID");

XmlElement statenode = xdoc.CreateElement("YesNo");

XmlText locationtext = xdoc.CreateTextNode(((TextBox)rptrItem.FindControl (chkstr)).Text);

XmlText statetext = xdoc.CreateTextNode("True");

Parentnode.AppendChild(locationnode);

Parentnode.AppendChild(namenode);

Parentnode.AppendChild(statenode);


locationnode.AppendChild(locationtext);

namenode.AppendChild(nametext);

statenode.AppendChild(statetext);

xdoc.Save(Server.MapPath("XMLFILES\\ReferrelGrid.x ml"));

DataSet dstXML = new DataSet();

dstXML.ReadXml(Server.MapPath("XMLFILES\\ReferrelG rid.xml"));

Myfirstgrid.DataSource = dstXML;

Myfirstgrid.DataBind(); <<<< ------------------- binding the grid view control to that XML Offline file

------------------

Maheshkumar.R

Nov 19 '05 #1
0 2045

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

Similar topics

7
by: Brian Sabolik | last post by:
I'm not sure if I've broken any Object Oriented rules or not, but ... I have projects in 2 different solutions that need to use each other's methods. Therefore I may have an "update" method in...
5
by: Sky | last post by:
What makes something a valid DataSource? What methods/iterators/etc? Why do I ask? I do understand that a DataSet is based on an XML structure...but it's too table structured for what I am...
2
by: Alan Silver | last post by:
Hello, I am just trying out reading an XML file in an ASP.NET page, but am having a little trouble. I'm sure this is something really obvious and dumb, but I can't see what ... I have an XML...
3
by: Joe | last post by:
Hi, I have written a webpage that allows a user to delete files in asp.net with I am having a small problem. To access this page a user has to login via login.aspx page. After successful...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
10
by: John Wilson | last post by:
My app produces some long datatables to display in a grid. So I put them in a div so users can scroll. But the grid headers scroll out of view. I would like to stop them doing this. Can I fix them...
3
by: Richard Ryerson | last post by:
I have a general DataGridComboBoxColumn that I built using the Example in the .NET 2003 Combined Collection help file (that was a data time picker). I am able to assign a data source and display...
5
by: SteveT | last post by:
I have a listbox and I want to set the DataSource property to a specific location of an XML file. Can someone tell me how? I want the DataMember property to refer to the <ChildTestsection to list...
5
by: Ken Varn | last post by:
I have just started using VS.NET 2005 after using VS.NET 2003. One of the things that I noticed is that in ASP.NET, the DataSource property for TextBoxes and other web controls is no longer...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.