Is it possible to applying some sort of “onClick” event on the XML nodes? With the following:
<tables>
<test>
<code>123</code>
</test>
<test>
<code>1234</code>
</test>
</tables>
If I read the XML file into my project and display it in a ListView, can I add an “on click” method to 123?
private void listView1_ItemActivate(object sender, EventArgs e)
{
testBox1.Text = "test";
}
When i try the onClick method above it displays test when i click on 123 and 1234, is their a way to specify the node you want the onClick method to work with.
Since XML is based in a tree-like structure, I wouldn’t use a ListView. I’d use a Tree View instead.
You can set “On CLick” methods to those. Not sure what you’re trying to do exactly though.
http://www.dotnetperls.com/treeview
ADDED: TO answer your other question – you will probably want to see the listview’s ‘selected item’ or ‘selected item index’ and write the code there. Its the same onClick event, just check what was selected.
Added 2: