Search Results

Search found 2 results on 1 pages for 'tonz'.

Page 1/1 | 1 

  • Deleting items from datagrid (xml)

    - by Tonz
    Hello, 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? <root> <element id="0"> <name>One</name> </element> <element id="1"> <name>Two</name> </element> </root> protected void dg_DeleteCommand(object sender, DataGridCommandEventArgs e) { XmlFunctions.Remove(index); }/*dg_DeleteCommand*/ (function on other class, where all my xml methods are written) public static void Remove(string index) { XmlDocument XMLDoc = new XmlDocument(); XMLDoc.Load(XMLFile); XPathNavigator nav = XMLDoc.CreateNavigator(); var node = nav.SelectSingleNode("/test/one[@id='" +???+ "']"); node.DeleteSelf(); XMLDoc.Save(XMLFile); } Edit: added datagrid <asp:View ID="viewDelete" runat="server"> <asp:DataGrid ID="dgDelete 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>

    Read the article

  • Passing trough a datagrid value

    - by Tonz
    I have a datagrid with 2 columns. One databound which display names and the other one is a hyperlink column. Column1 = databound column, Column2 = hyperlink column. column1: column2: --------------------- Name1 Modify Name2 Modify Next when i click on any of the values in Column2 i simply get redirected to a other page. This page contains 2 buttons/hyperlinks with Yes or No. (does not mather wich control, which one would bring the most easy to implement solution atm) When clicked on No it simply redirects back to the orignal page. Now the question is when i press "Yes" how exactly do i acces "Name1" (or Name2 if i press on the second modify)? Meaning if i press Yes i want to use this Name for certain opertions (xml). To put it short if i press on "modify" i want to be able to get that name associated with it (which is already displayed in the first bound column left of it). So the goal is to use that name in Xpath for example so i can make a query towards that node with that certain name. Hopefully this made some sence.

    Read the article

1