C# - Deleting Entire Xml Node With Datagrid?

Dec 25, 2010

I have the following xml structure:

<systemtest>
<test id="0">
<name>Test One</name>
</test>
<test id="1">
<name>Test Two</name>
</test>
</systemtest>

The name gets displayed in the 1ste colum of the datagrid, where in the 2nd colum there is a buttoncolumn with delete button.

How exactly can i use xpath and navigate to the current node lets say with test id="0" and delete it (including name)?

Its unclear how i can say to this method what row he has to delete exactly.

[Code]...

This does delete the first item, but offcourse crashes on the second. How an i make this into something variable that is bound depending on what button i press in my datagrid?

View 1 Replies


Similar Messages:

C# - Deleting Items From Datagrid (xml)?

Dec 25, 2010

I have a datagrid buttoncolumn which acts as delete buttons for my xml nodes. The elements are simply displayed in a boundcolumn, so there names get displayed.

Each item generated gets a unique id (each time one is made id+++). My question his how can i remove a item (the entire element node with that certain id) when i click on one of the buttons in the bound column?

[Code]....

View 1 Replies

Forms Data Controls :: How To Save Entire Datagrid

Feb 21, 2010

I was going to display some data using the datagrid tool but rather than being able to edit one row at a time I need to have all cells on all rows in the edit position and then I can save the entire table. Is this possible using datagrid and if not what how should I use a different control?

View 1 Replies

Datagrid With Tags - Click Any Cell And Highlight Entire Row

May 25, 2010

I have <span> tags in the cells of my datagrid which determine which background color to use. I also want the user to be able to click any cell and highlight the entire row. This works anywhere there's not a span tag. The span tag is somehow canceling this out. What would you do so that fields inside a span tag act like regular fields where you can click on them and the entire row is highlighted?

View 10 Replies

C# - Datagrid Getting Selected Value (delete Xml Node)?

Dec 26, 2010

Lets assume there are 2 columns in my datagrid:

<asp:View ID="viewRemove" runat="server">
<asp:DataGrid ID="dgRemove" runat="server" AutoGenerateColumns="False" OnDeleteCommand="dg_DeleteCommand">
<Columns>
<asp:BoundColumn DataField="name" HeaderText="names" />
<asp:ButtonColumn ButtonType="PushButton" Text="Delete" CommandName="Delete" ></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
</asp:View>

The first column displays names from a xml file and the button column just hold delete buttons so i can delete the corresponding item to the left of it (1st column).

How exactly can i retrieve/pass this selected value to a function? In other words when i press the button to the right of the name, it passes the value so i can work with that to remove the corresponding xml node. (using XPath)

XmlDocument XMLDoc = new XmlDocument();
XMLDoc.Load(file);
XPathNavigator nav = XMLDoc.CreateNavigator();
var node = nav.SelectSingleNode("/root/name['" + ??? + "']");
node.DeleteSelf();
XMLDoc.Save(file);

View 1 Replies

Forms Data Controls :: Deleting From A Datagrid Without Having A Delete Button?

Apr 21, 2010

i have a project that allows users to send requests to another user. When the user views the requests he can select reply. I want to be able delete the item after the user selects reply

View 5 Replies

Forms Data Controls :: Datagrid Deleting Random Rows?

Jul 14, 2010

I have an asp.net 2.0 web app and one of the pages uses a grid to add/edit items before exporting the contents to excel. The items in the grid are selected based on a dropdown list--after the item in the list is selected, the grid goes and gets the items, populates a dataset and binds the dataset to the gridview. Some of my users are experiencing an issue where after deleting a random number of rows, a row not deleted will disappear or reappear. Though I have witnessed the behavior, I cannot duplicate it on my machine where the developement occurs (Win XP Pro, IIS 5.1, vwd2005 express). The windows 2003 server uses ASP.Net 3.5

Here is the code related to editing and deleting:

[Code]....

If I had to make a guess as to what was occuring, I would say that it appears at times to retain the deleted item's index after the grid is sent back to the user and tries to delete another row. But like I said, I can't duplicate the problem on my dev machine. if this might be caused by .Net 3.5 trying to run a 2.0 site?

View 5 Replies

Web Forms :: Error - Could Not Find The Sitemap Node With URL 'Menu1.aspx?node=hardware'

Dec 8, 2010

Is it possible to have >1 sitemap files so that I can separate section 1 and 2 into two separate sitemap files?

The codes give this error:

Could not find the sitemap node with URL 'Menu1.aspx?node=hardware'.

The .aspx file has:

[Code]....

The Web.sitemap file contains:

[Code]....

[Code]....

View 6 Replies

C# - Deleting From Repeater Item - Erroneous Deleting?

Sep 27, 2010

I have a repeater which binds a set of data. Within this repeater is a column with various controls for updating, deleting, etc. These are image buttons which fire an onclick event such as "DeleteRecord". All this does is fire a stored procedure, passing in the ID of the record to delete from the CommandArgument of the object.

This works wonderfully... except for one rather huge problem. Once you delete a record, if you refresh the page, the record where the first deleted record used to be gets deleted. For instance... if I have 4 records

1 Record1
2 Record2
3 Record3
4 Record4

and I delete record 2... The page reloads with (which is fine):

1 Record1
3 Record3
4 Record4

...if I then hit refresh...

1 Record1
4 Record4

I assume this is because the erroneously deleted object (record3) is now in the same hierarchical place as the old object used to be and .net therefore doesn't know the difference, the page refreshes and fires the onlick event, grabbing out the command argument of the new object and deletes based on the ID as obtained from the commandargument of the new object. This is obviously a huge problem, if a client did this it would destroy data erroneously and I'm at a loss here. Is there any way to stop this from happening? I'm not sure if there is a better way to go about doing things or not. If there isn't, I need some sort of way to tell the page not to execute the event or to cross reference the ID of the object that is intended for deletion against the object itself...

Code below for convenience...

EDIT Wrapped a LinkButton around it because I have some jquery code in here as well which stops the page execution to wait for user confirmation. Pressing "ok" continues page execution.

<asp:LinkButton ID="oDeleteLink" CssClass="oDeleteIcon" CommandName="Delete" CommandArgument='<%# Eval("iAccountID") %>' runat="server">
<asp:ImageButton ImageUrl="/files/system/icons/trash-steel-16.png" ToolTip="Delete This Account" AlternateText="Delete" ID="oDeleteIcon" runat="server" />
</asp:LinkButton>
protected void oAccounts_ItemCommand(Object Sender, RepeaterCommandEventArgs e) {
if (e.CommandName == "Delete") {
int ID = e.CommandArgument.ToString().Numeric();
db.SPs.SpDeleteAccount(ID).Execute();
UI.Confirm(uiBroadcast, "Account has been deleted", "300px");
BindAccounts();
}
}

View 2 Replies

Forms Data Controls :: Read Selected Node And Its Parent Node Values For Treeview In JavaScript?

Feb 18, 2011

how to read selected node and its parent node values for treeview in asp.net in JAVAscript.

View 3 Replies

AJAX :: When Expand Another Node, The Previous Expanded Node Collapses?

Oct 19, 2010

I created a sitemap with a treeview navigation in my aspx site. I am hoping someone can show me the code to put in a Masterpage so that when I expand a child node, all other nodes collapse, and when I expand another node, the previous expanded node collapses.

I have an example here of what I am trying to accomplish:

[URL]

I am using asp.net with VB.

I have been scouring the internet looking for a solution, but so far haven't found anything that works.

View 1 Replies

VS 2010 Populate Child Node When Parent Node Is Selected

Oct 16, 2012

I'm populating a treeview dynamically. On OnTreeNodePopulate I call a sub and populate the Parent nodes. I do not want to populate the child nodes at this time. Upto this point it works fine.

Now I would like the user to click the parent node and then populate the child node. I tried to use TreeNodeExpanded, but that is called for each parent node, so that didn't work.

View 1 Replies

C# - Find Node By Title And Delete It, But Always Is Deleted First Node?

Mar 31, 2011

<?xml version="1.0" encoding="utf-8"?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode url="~/" title="Úvodní stránka">
<siteMapNode url="Pocitace" title="Počítače" />
<siteMapNode url="Elektronika" title="Elektronika" />
[code]...

View 2 Replies

Web Forms :: Sitemap Node - Seond Line Of Sitemap Node Won't Indent?

Mar 25, 2010

I have a second level node that goes onto two lines. The first line indents 15px as is set by the class for node level 2. The seond line kicks back to the same level as 1st level nodes. Here's what I mean:

Parent Node

Second node

line 2 of second node

I want it to be like this:

Parent Node

Second Node

line 2 of second node

View 4 Replies

Web Forms :: Add Child Node And Sub Child Node To The Tree View Dynamically

Jan 22, 2011

i want to create one treeview dynamically which will have child node and sub child node.for this i am getting my treeview value from the table with below column:Id,Name,Parent,IsActivewhere main parent nodes parent id will be 0 and then all other records parent id would be related id. the table structure would look

View 3 Replies

TreeView Are Selected Node Style Doesn't Appear To Selected Node

Aug 11, 2010

<asp:TreeView ID="TreeViewCategories" runat="server" ExpandDepth="0" Style="min-height: 200px;
max-height: 500px;" LineImagesFolder="~/TreeLineImages" NodeIndent="0" LeafNodeStyle-CssClass="LeafNodesStyle"
CssClass="TreeView" NodeStyle-CssClass="NodeStyle" ParentNodeStyle-CssClass="ParentNodeStyle"
[code]...

View 2 Replies

Forms Data Controls :: How To Filter Child Datagrid On Parent Datagrid Row Select

Apr 6, 2010

I have 2 grids gvParent & gvChild I would like to filter gvChild when a row is selected in gvParent the linking fields are contractNo

I added a column for selecting:

<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select"
OnClick="LinkButton1_Click" Text="Select"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>

I know how to handle the filtering of the grid (create a criteria and set to rowfilter of the dataview) But, I dont know how to get the value of the column of the selected row.

View 5 Replies

Forms Data Controls :: Want To Capture - Datagrid On Clcik On Datagrid Row Value Using C#?

Mar 4, 2011

I have Datagrid , i want to clcik on row and get data in textbox , but my textbox is FreeTextBox control,i tried to use javascript but work for asp.net control not working for freetext box control, how i can capture this code is sample code but it work for asp.net control but not working for my freetextbox

[Code]....

View 1 Replies

Forms Data Controls :: How To DataGrid SelectIndex Inside A DataGrid

Sep 22, 2010

Simply put... I want to duplicate the example found at this link, in VB.net rather than C#.

[URL]

I would like the selectedvalue of the dropdown to display additional data base on its selection in multiple text boxes.

I have tried using the DropDownList OnSelectedIndexChanged property, within a DataGrid EditiItemTemplate, but I cannot retrieve data from the selection. (AutoPostBack is "True"). I can however use a button onclick event to fire a "prre-defined" selection value.

View 2 Replies

C# - How To Access A Child Datagrid Which Is Inside Of Another Datagrid, Before It's Not Binded

Jun 23, 2010

I have a nested datagrid. I want to get header texts of child datagrid, bifore binding process.

Is there a way to do this?

View 1 Replies

Forms Data Controls :: How To Find DataGrid Row From Another DataGrid

May 27, 2010

I have 2 datagrid (using .net 1.1). I need to access column of second grid ( i need to make a column of second grid as disabled) when i click "Cancel" link button in First Grid. How can this be done?

View 7 Replies

Web Forms :: How To Assign Values Of Data Table To A Datagrid When Datagrid Has Data List And Text Boxes

Jan 8, 2010

I had called the data from query to data table and now i have a gridview in which i am using one datalist and 2 text boxes and and reming coloumns are bounded iahve to assiaign them values which datatable have either null or any value.

View 2 Replies

301 Redirect For An Entire Subdomain?

Nov 7, 2010

I want to wipe a subdomain off the face of the internet.

So any page in the sitemap I want it to 301 redirect over to the homepage of the main www site...

Can that be done? I tried setting the re-direct in IIS, but it only worked if I hit the homepage (the subpages all 404d)

View 1 Replies

C# - From Within A Xslt, Can You Output The Entire XML?

Apr 16, 2010

Inside my XSLT that is transfomign a order XML, I want to dump the entire XML I am currently working with.

Is this possible? I am weaving some HTML based on XML, and want to dump the entire XML into a textarea.

View 4 Replies

What's The Best Way Of Duplicating An Entire Website

Mar 4, 2011

I've built a complex site for a client, who wants this duplicated, and re-skinned, so it can be used for other means. What is the best way of doing this? I'm concerned about copying every file as this means any bugs must be fixed twice, and any improvements must be implmented twice.

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved