Hi all,
The result I'm looking to acheive here is that the user is presented with a grid of notes, and when they want to add a new note, they type into a "NoteText" column on the bottom row, and select a "Note Type" from a DropDown column on the bottom row.
Please consider my scenario:
I have a class structure that looks like this (but can be changed as required):
clsNotes
clsNote
clsNoteTypes
clsNoteType
Let's say clsNote also has a "NoteID" property and a "NoteText" property, and that clsNoteType also has a "RecID" property and a "Description" property.
On my form, I instantiate MyNotesObject as clsNotes and bind it to my UltraGrid. In my UltraGrid I now see 2 columns: "NoteID" and "NoteText" - but alas where is my "note type"?
HERE IS MY QUESTION: What is the accepted way (if any) of having my clsNoteTypes class appear AS A DROPDOWN column in my UltraGrid?
Any information or reference material pertaining to this issue will be appreciated.
Regards,
Scott Pearce
Hi Scott,
In order to acheive this, what you would need to do is add a property to the Node called "NoteType". This would be a numeric field that equates to the RecID of the NoteType.
Then you need to use a ValueList on the grid column to provide a dropdown list. You will probably want to bind this list to your clsNoteTypes class. You have a couple of options for the list: you could use a ValueList or an UltraDropDown. For a simply list like this, I recommend the ValueList and since it's going to be bound, you will want to use a BindableValueList. If you create a BindableValueList and bind it to the clsNoteTypes list, you would set the ValueMember to "RecID" and the DisplayMember to "Description" and then set the ValueList property of the column to this BindableValueList. The BindableValueList takes care of the rest, storing the ID in the grid cell, but displaying the description to the user.
Thanks for your help - I'm now adding an unbound column to my grid, and setting it's ValueList to be a "bindable value list" variable, which is bound to my clsNoteTypes class.
So now I have a grid bound to my clsNotes class. Picture what I have in your mind: The grid is now populated - I have a bunch of rows, each with bound columns "NoteText", "Creation Date", etc. There is also "NoteType_RecID" column. Next to that is the drop down list of all possible note types (an unbound column, created as you instructed above) - the DisplayMember of this dropdown is "Description" and the ValueMember is "RecID"
My questions relating the above scenario:
1. How do I set the value of the drop down column such that the note type that corresponds with the "NoteType_RecID" for that row is showing?
2. How exactly should I handle things when the user changes the drop down value?
Thanks for any answers you can provide. I know it's tough to do this sort of thing without "seeing" the actual code.
Regards.
Scott