Good evening folks, I'm new here and I hope someone can give me some extra insight into my current situation.I'll try and be as complete and to the point as possible in describing my situation.Basically I have a Windows Form UltraWinGrid which I'm populating with List<T>, however, I wish to replace several id-fields by their respective description fields.Let's scetch my situation with a simple example.Say I have a List<Customer> and the Customer class includes the usual properties like name, first name, birth date, ...But also various id fields. The Customer class is a object that gets it's data filled from OR mapping from a persistent storage medium, in my case that's a SQLServer2005 database, the id fields are basically the relationship fields from the database. Basically Customer object is pretty much an object representation of the persistent table.So for example:public class Customer{ String name, firstName, PhoneNumber, ... int customerId, favColorId, livingPlaceId}public class FavoriteColors{ int favColorId string colorName, hexNotation, string RGBNotation}public class LivingPlace{ int livingPlaceId string country, city, countryCode, postalCode}So I have a List<Customer> customers and bind it to my grid in code behind as 'customersGrid.Datasource = customers'This works fine and my whole system has already been programmed around working like this. So for functionality there's no problem. After all, it's the id values that are used for the programmatic identifying and so on.However like this I display values to the user that he wouldn't really understand as the first record would for example be CustId Name FirstName Phone FavColorId LivingPlaceId1 Me Me Again 2211 1 1So when displaying the grid I would like FavColorId to be replaced with it's colorName with that Id. The same for livingPlace, I'd want the grid to show country for example with that stored id.For this example let's assume the values are stored in a List<FavoriteColors> and a List<LivingPlace>.That's what I'm seeking to accomplish in a nutshell. I was thinking of adding an unbound column for each id-field (in code) after setting the datasource to customers (haven't looked it up yet, but that should be possible right?), and afterward I'd go through the whole grid with a foreach(UltraGridRow in grid) loop, filling the unbound columns with the looked-up data.And then I'd hide the columns that the user doesn't actually need to see.However, I suppose that'll be rather performance ineffective, so was wondering what you folks think of this.Ok, I think that's about it.
Mike,
I have discovered that if the ultraGridBand.Columns(ColumnName).Style is set to UltraWinGrid.ColumnStyle.Default, instead of UltraWinGrid.ColumnStyle.FormattedText, then the ValueList Items will display properly.
Apparently, a column style of FormattedText is not compatible with a ValueList.
Regards,
Rob
Nassos,
Thank you for your response,
Yes, I understand the use of a ValueList, and it is what I am after. I have no desire to put a combo, dropdown, or any edit control within a grid at the moment. As it is such a challenge just to get the grid to display the data properly, I shall leave editing out of it.
R.
While, waiting for your reply, I continued my search for alternate methods, and found the following code in one of your knowledge base articles:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=1035
So I followed the technique:
1. Instance a new ValueList with in a grid; 2. add items to the value list.; 3. assign the list to a column within a band; and lastly; 4. set the ValueList display style.
Might I add, the original How To article referenced in this thread, fails to mention Step 4, setting the display style, within the paragraph concerning value lists. It is a little annoying to find two articles on the same subject that are not consistant with each other. You would hate to be that sorry developer who pulls their hair out because they read the article that didn't give them all the correct code in the sample provided.
Anyway, not that it matters, neither code works, Same result. The desired List Values are not being displayed. No errors or exceptions are being thrown.
I don't believe a "small sample project" would suffice as it wout take the code out of context. It would seem that a property setting or method being called is in conflict with the use of a ValueList, althought such is not easily identifiable, as it does not create an error. I would need to show you everything that I am doing to the grid so that the proper test conditions are replicated. Not that I have time for this nonsense, but I suppose it is the only way I'll get an answer.
Hi Rob,
It might help if you could be more specific about exaclty what you are doing and what's not working. The method I describe here definately works. So if it's not working, something is wrong.
If yuo can't get it to work, create a small sample project and Submit an incident to Infragistics Developer Support. They should be able to tell you why it doesn't work.
Hi Rib,
What Mike sugested is the best way, another way is to put in your Form an ultraCombo , fill it and add it to the EditorControl property of the Desired Column, insite the InitializeLayout Event of the grid:
e.Layout.Bands[0].Columns["DesiredColumn"].EditorControl = myCombo;
Mike's suggestion :
e.Layout.Bands[0].Columns["DesiredColumn"].ValueList = myValueList;
PS. the valueList is lightweight compare to the ultraCombo so quicker to initialize.
Hope that helped.
Nassos