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.
I've been fighting this problem for a day now and thanks to Vince's post here I fixed my problem. I had a column in a grid which was an int but since I was binding the grid to the dataset in code it didn't set the datatype of the column and it defaulted to a string. That column had the editor control set to a dropdown list where the datavalue field was an int and the dropdown list would only show when I clicked on the cell. Once I set the datatype of the grid column explictly to an int the dropdown now shows all the time. Thanks Vince, and maybe the ultrawebgrid should throw an exception when the editor control's datatype doesn't match the datatype of the column you're binding to.
Did you find a solution for this.?
I have a similar problem and definately need help. I used cascading webcombos in my ultrawebgird(2009 vol 1). I had no problem of saving data, but the data cannot be displayed properly. Some of the dependent webcombos just display the value not the text. It looks like some of cells cannot bind to the webcombos.
I have specified the DataSourceID, dateTextField. dataValueField for webcombos. I also checked the datatype of webcombo and the data in the grid, they are all int type.
Thanks.