Hi
Say I have a column called CategoryId that contains a numeric value and I want to display a text representation of that value in each cell plus allow the user to edit the value by using a ComboBox editor.
In the asp.net/windows forms grid i could do this by use of a ValueList or ComboBox, setting the datasource of the ComboBox and setting the displaymember and valuemember properties. How can i do this with the xamWebGrid?
Thanks again.
Kevin
I sure wish that you guys had an example of exactly this.
Certainly one of the most common things in LOB applications is working with denormalized tables. I have spent more hours than I care to admit combing through these forums and I have still yet to see this as an example.
Hi Devin,
Could you please give me the code of categoryConverter and categoryProvider? I Cant find it in the samples.
Thank you very much.
Sandra
Thats great, thankyou.
Assuming I fully understand your scenario, yes this is possible. What I hear you saying is that in addition to the ComboBox value editor, you want the cell to display a string based on the cells bound numeric value.
To do this all I would do is create a custom ValueConverter that does the ID to string resolution (probably by simply executing a LINQ query against the same items source that I am binding to the combobox), then add that to the binding statement of the TextBlock in the ItemTemplate.
Devin
Thanks for that example. I didn't notice you could scroll to the right for even more samples !
I have followed the example and it is not quite the same as my situation. The sample has a category column that displays category names from the itemsource and the combobox is also populated with category names. What I have is a categoryId column with the numeric Id of the category. The itemsource of the combobox is a list of categories with ID and Name properties. I want the grids categoryId column to display the category.name resolved from combobox editor using the id's. This is achievable with asp.net grid and win forms grid.
Can this be done?
Thanks