Hi,
I am using Ultrawingrid that is binded to a collection of IList. I have a class of Employees and one property of this class is City type. Now when i bind this collection with grid, City column show me of object type. I am using ultradropdown to list Cities and when i select any city it should show selected city in that column. How can i do that? currently we specify Value Member as CityID. Also when showing record it should show city over there.
What exactly is the DataType of the Employees.City field? If it's returning an object, then the grid cell will contain that object. There's no way for the grid to know that it needs to match up that field with an ID which is a property of the City object.
It sounds to me like your City field should probably be a CityID rather than a City object. Then you list would contain a list of CityIDs and City names.
Ok, let me explain with another example.
I have an ultrabindingcontrol. its datasource is binded to "Machine" class. Machine class has following properties
MachineID int
Description string
Product productClass
Now i am binding ultragrid's datasource property to ultrabindingcontrol object. when i bind, it converts the "Product" column's datatype to "productClass".
My requirement now from here is that, i want to use drop down of products linked with this column. When i shall select any product from drop down it should be listed over here.
Kindly suggest me how to do?
Yes, now i got it. I am using nhibernate classes. So, i shall change the product to productID and drop down will return me selected value as "ProductID".
Thx for ur kind support
I don't understand. What is "ultrabindingcontrol"? There is no such object I am aware of. Is this something you created?
sadaqatbukhari said:Now i am binding ultragrid's datasource property to ultrabindingcontrol object. when i bind, it converts the "Product" column's datatype to "productClass".
The datatype of the column will be the data type of the field in the data source. So I don't know what you mean when you say it "converts" the data type. That has never happened in my experience and I don't see how the grid could possibly be making up a data type that doesn't exist. If the data type of the field in the data is Product, then the data type of the grid column will also be Product, which I assume is a class you created.
If you want a dropdown list of products in this column, then you would have to create a list that contains Product objects. You would also have to make sure that the Product class overrides the Equals method so that two different references to the same product know that they are equal to other other.
This would be a little odd, though. Usually, the Machine class would have a Product ID, not a Product object. Storing the product as an object means you have to deal with all sorts of little quirks like dealing with reference comparisons by overriding the Equals method. It will also require more code to sort or group this column, since an object has no obvious ICompable implementation.