Hi,
I am binding a valuelist to my ultrawingrid as shown in the attached sample. the value list items can change based on the value of the status column.
click the mouse on the cell on the 3rd column
1. when i change the value in the value list 1st row the cell updates properly
2. when i change the value in the value list 2nd row the cell updates properly
3. when i try to change the value in value list in 3rd row it changes the cell value of the 1st row.
similarly if we edit multiple rows.. all the previous edited rows get affected once we move the move to a new row
Please help me in resolving this.
thank you.
Hi Ravindra,
There no difference between a bound column and an unbound column as far as ValueLists go. My best guess with such limited information is that your bound field is probably ReadOnly. Therefore the cell is read-only, and therefore, you cannot show a dropdown, since dropdowns are for editing the value of a cell. Are you able to edit the cell? Can you go into edit mode and get a blinking caret? Can you type into it?
I have an Entity Accounts that has a Foriegn Key Contraints on CalcType Entity.
When I bind the UltraGrid to the this Entity Accounts. The UltraGrid's Column 'CalcType' is not getting displayed as DropDownList even though I am specifying the Style and providing the ValueList to the Column.
UltraGrid_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
e.Layout.Bands[0].Columns["CalcType"].Style = ColumnStyle.DropDownList;
e.Layout.Bands[0].Columns["CalcType"].ValueList = // Code to get the valuelist ;
}
However, for an unbound entity it displays the Dropdown correctly.
if (!e.Layout.Bands[0].Columns.Exists("CalcTypeEdit"))
e.Layout.Bands[0].Columns.Add("CalcTypeEdit");
e.Layout.Bands[0].Columns["CalcTypeEdit"].ValueList = // Code to get the valuelist ;
The above works. Please suggest a work around or solution (in case I am not using it correctly).
Regards,
Ravindra Mohan
Thank you Mike. I will try to implement the solution using a UltraDropDown control.
You code here doesn't make a lot of sense to me.
If you don't want the ValueList to be attached to the cell until the user tries to edit that cell, then that's fine. But you should use the BeforeEnterMode event, not MouseUp.
The way you have this set up now, is that if a cell in the Status column happens to be active and I click anywhere in the grid - or even try to click off of the grid, the list drops down and you cannot escape it.
Also, the cell enters edit mode on the MouseDown, but the MouseUp. So when you click the cell, it goes into edit mode and then when you release the mouse, you are changing the ValueList while the cell is already in the middle of an edit. So my guess is that this is the real reason this is not working.
I tried moving your code from MouseUp into the BeforeEnterEditMode event, but of course, this does not work, because you are not allowing editing on the Status column.
I also tried MouseDown, but it looks like the cell enters edit mode before the MouseDown event is called, so this does not work either.
I tried a bunch of other methods to get this to work and I cannot get it to work the way you want. There's probably some kind of caching going on here in the grid cell where it's holding on to the selected ValueList row.
I think the only way you can do what you want here is to use the UltraDropDown control and filter the items. That way you don't have to create a new list for each cell and you can keep the entire list all the time and simply filter out the items you don't want the user to be able to select.
Hi Mike,
I want the dropdown to be displayed only after the user clicks on the cell and then the cell will be in edit mode. I need this because if i bind the value list in the initialize_layout it displays the drop down when ever i do a mouse hover on the Status column on all the rows.
One more thing is my status can change dynamically based on the current status on the cell. So what i mean is my value list can have different list of items for each row. That is the reason i want to populate them when i click on the cell.
In the UltraGrid1_MouseUp event if i am currently setting the value list for the cell. and when the dropdown apprears and the user selects any value then i am handling it in the UltraGrid1_AfterCellListCloseUp by checking the e.Cell.EditorResolved.IsValid flag and then taking the e.Cell.EditorResolved.Value to validate if the selected value is a valid value list item.
In this case if i click the cell on the 1st, 2nd, 3rd row it works fine.. After if i go to the 1st row and click the cell the e.Cell.EditorResolved.IsValid flag is False and the cell value remains like 0,10.. and the drop down doesnt appear.
I think i am not able to find the right event to do this. Please help me on this. If possible can please fix this in the attached sample and let me know?