Hi all. This one might be a little hard for me to explain, I'll try my best.
I have an UltraWebGrid with some of it's ColumnEditors set as Custom. Then I set the EditorControlID to a WebCombo. The problem here is that I'm trying to populate my WebCombo by first reading the values I have for the cells belonging to that column and then querying the DB to get the 'text field' related to ta ID value within the cell.
What I'd like to know is what could I do so that the grid would display the text field that I have set in the WebCombo working as an editor for that column. So far, I have the ID displayed in the cell and when I enter to edit it, the combo is shown and the text displayed is actually the Description field. I'd like the grid to show this field instead of the related ID.
My guess is that it has to do with the order of the events that are being fired. In this case I have to populate the combo after DataBinding the grid as I have to get those values to then populate the combo and set this populated control as the EditorControl.
Hope my post is not too messy. Thanks for your help.
Have you set the DataTextField property of your WebCombo to the Key of the WebCombo column for what you want displayed in the grid cells?
I don't think that the order of events should have much to do with this, so long as you have the editor control set and the combo populated before the page renders.
Hi, Vince. Thanks for your reply.
I have set this property already. I thought it could be a matter regarding the order of the events since I'm binding the webGrid before I have populated the combo (the combo is populated with the values I get from the grid). I'm not sure how the relation between IDs and Texts is done, but I thought the problem could be that the grid cannot find any values in the combo to relate to.
I have been trying other ways to achieve what I want and I found out that if I add a TempleatedColumn instead of a UltraGridColumn, everything seems to work fine. It's the same combo, populated the same way and everything. But this was just a test and changing those columns to TemplatedColumns would be quite hard. So, is there anything special in the TemplatedColumn that I could configure in a regular UltraGridColumn to get this behavior I'm gettin with the TC? Thnaks again.
I've set editor control assignments and the DataTextField/DataValueField properties on WebCombos in a variety of orders in the past, and it's always given me consistent results. This is why I suspect that this isn't an order-of-events issue.
I'm assuming that the ID that is showing is the actual value of the grid cells?
If that's so, then you should double-check that the data type of the WebGrid column matches the data type of the DataValueField column in the WebCombo. If one is a string and the other is an integer, for instance, it'll simply show the cell values when the page is initially rendered, but will "correct" itself when you try to edit the cell.
I don't entirely understand, however, why this would work if you're using WebCombo controls in a templated column, as opposed to using a single WebCombo control as the editor for a similar column.
That was it! I can't thank you enough, Vince. I really appreciate it. Thanks a lot! :-)
I'm glad to have helped! That scenario is one that can trip people up quite easily, and it's not easily noticed.
And this is actually one of the final touches for the first version of this project to go out to the wild world, that's why I'm more than glad and thankful for your help. There's only one more glitch to solve that I've been wandering about for a little while but I'll see what I can do and if theres no luck, I'll be oon asking for your great help once again :-)
Thanks and keep doing such a great job ;-)