i would like the Cells in my ultraGrid (1 Column) to not have the text field editable when bound to a UltraDropDown
I believe I am having a similar issue to the person in this thread:
http://www.infragistics.com/community/forums/p/3440/18306.aspx
My problem is that even though I set the UltraDropDown's Column style and the UltraGrid's Column style to UltraWinGrid.ColumnStyle.DropDownList they are still editable before and after selecting somthing from the list. I think this may be caused because not every row has a UltraDropDown List bound. This is because some rows need to be editiable by the user.
I have a UltraComboEditor on anjoter part of the page working the way I would like the ultraDropDown's to work in the grid by using UltraComboEditor1.DropDownStyle = DropDownStyle.DropDownList
I can post some code if it helps, but just figured I'd ask if this is a known bug.
Also posted on Stack Overflow with images http://stackoverflow.com/questions/18403477/infragistics-ultradropdown-in-ultragrid-disable-editing-text-ultrawingrid-colu
Hi,
I'm afraid I'm not clear on exactly what you want. It sounds like you want an UltraDropDown in a cell of the grid, but you don't want the user to be able to change the value of that cell at all - even by selecting a row in the dropdown?
DropDownList on the UltraDropDown columns will not have any effect here. Only the DropDownStyle of the grid column to which the dropdown is attached matters. And this property will only limit the users ability to type into the cell - it will not stop them from choosing an item from the list.
There's no way to have a dropdown in a cell that cannot be edited by the user. Quite frankly, that would be a confusing UI for a user. I know of no other application that does that. If a user sees a dropdown list, they are going to expect to be able to choose a new item.
Sorry if I was not clear initially. What i want is for them to be able to select something from the drop down but not be able to edit the text in the row. For example if they select "Foo" from the drop down, they should not be able to backspace it and type "bar", they should either stick with "Foo" or select something new from the UltraDropDown.
This is what is Happening, Where I typed "EDIT" I wish to not be able to type at all, bnut only allow selecting an option from the dropdown.
This is what the cell looks like after selecting a value. Editable
I have what I want working on a UltraComboEditor on another part of my page outside of the grid. It looks like this after selecting a value. Un-Editable
I have tried this in my Initializelayout:
UltraGrid1.DisplayLayout.bands("Bottom").Columns("Values").Style = UltraWinGrid.ColumnStyle.DropDownList
I think the issue might be that not every cell in my "Values" Column has a UltraDropDown bound to it.
Okay. That's very easy.
grid.DisplayLayout.Bands[1].Columns["Values"].Style = ColumnStyle.DropDownList;
If you have to do this for some cells and not other, then use the InitializeRow event and set the Style property on the Cell to DropDownList. Presumably you are already using InitializeRow to apply the dropdown to the cell, so you would set the Style on the cell at the same time.
I was actually setting the drop down when creating each row. The data I am being passed is parsed into arrays from XML files. This results in me setting each cell one at a time. Code looks something like this
reportName = UltraGrid1.DisplayLayout.Bands("Top").AddNew() 'add top level row to grid reportName.Cells("Report").Value = array3(1, i) 'report name to new row For k = 1 To array3(3, i) 'loop for amount set in parent array parameterName = UltraGrid1.DisplayLayout.Bands("Bottom").AddNew() 'add bottom level row to grid parameterName.Cells("List").Value = array1(7, counter) If Not parameterName.Cells("List").Value = "" Then parameterName.Cells("Values").ValueList = UltraDropDown1 parameterName.Cells("Values").Value = array1(8, counter) parameterName.Cells("Values").Style = UltraWinGrid.ColumnStyle.DropDownList Else parameterName.Cells("Values").Value = parameterName.Cells("HiddenVal").Value 'set for textbox parameterName.Cells("Values").Style = UltraWinGrid.ColumnStyle.Edit End If Next
reportName = UltraGrid1.DisplayLayout.Bands("Top").AddNew() 'add top level row to grid
reportName.Cells("Report").Value = array3(1, i) 'report name to new row
For k = 1 To array3(3, i) 'loop for amount set in parent array
parameterName = UltraGrid1.DisplayLayout.Bands("Bottom").AddNew() 'add bottom level row to grid
parameterName.Cells("List").Value = array1(7, counter)
If Not parameterName.Cells("List").Value = "" Then
parameterName.Cells("Values").ValueList = UltraDropDown1
parameterName.Cells("Values").Value = array1(8, counter)
parameterName.Cells("Values").Style = UltraWinGrid.ColumnStyle.DropDownList
Else
parameterName.Cells("Values").Value = parameterName.Cells("HiddenVal").Value 'set for textbox
parameterName.Cells("Values").Style = UltraWinGrid.ColumnStyle.Edit
End If
Next
When I tried to write a InitializeRow event i was caught with "ArgumentException: Key not found: 'List' Parameter name: key"
Private Sub UltraGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles ultraGrid1.InitializeRow
If e.Row.Cells("List").Value = "" Then
UltraGrid1.DisplayLayout.Bands("Bottom").Columns("Values").Style = UltraWinGrid.ColumnStyle.DropDownList
End Sub
Thank yu for your help, i ended up using
I also tried this with zero errors but it did not work:
Private Sub UltraGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles UltraGrid1.InitializeRow
If e.Row.Band Is Me.UltraGrid1.DisplayLayout.Bands("Bottom") Then
If e.Row.Cells("List").Value Is "" Then
e.Row.Cells("Values").Style = UltraWinGrid.ColumnStyle.DropDownList