Posted on 2003-12-08
Let me start by saying I'm a total novice at C# programming, so any answers should be relatively self-explanatory.
I'm using VS .NET to try to create something loosely similiar to a windows help file - I have a treeview control on the left and a textarea on the right - when a user clicks on one of the nodes in the treeview the textarea should receive the corresponding data.
I actually have two questions -
1) All of the data for this project is being populated by a sql server db table, which i read into a dataset when the form is loaded - the table has ID, helptitle, and helptext fields. The helptitle field ends up in the treeview nodes and the helptext field is what gets populated into the textarea when the helptitle node is clicked. What's the best way to extract the helptext field given the ID field? I'm currently using a dataview filter to get the correct row each time but I dont know if this is a 'best practice'.
2) More importantly, I'm having trouble with the event model - currently I have an event handler set up for the treeview's afterselect delegate(?) and I've also tried the selectvaluechanged. It appears, however, that these events are firing several times even before the user has a chance to make a selection (when the form is initializing?) This is causing problems because the event handler attempts to determine the value of the selected node (which in this case is a helpID) in order to get the corresponding helptext to populate the textarea. When these events are firing, however, the value appears to be System.Data.something instead of the integer value I'm hoping for.
If you need me to post some code I'll try to do so.