Hi All-
I have a scenario in my application to select more than one value in win grid cell. i followed this article
http://forums.infragistics.com/forums/p/10347/40409.aspx#40409
to create a text box with button control set to a win grid with check boxes. I setted the cells editor control to the text box. Everything is fine and the user can select more than one value in the grid.
The only problem with this appraoch is what ever user is selecting in the grid is applying to each and every row. In my application context the user can select different options for each row.
Any ideas???????????
-Thanxs for ur help.
Thanks Swetha!!
You really made my job easy.. Its working as expected.
Somay-
All you need is write an event for the grid inside the text box which allows you select multi values. Assume that the "Multi Value" column is where the drop down is and inside the grid, There is a check box column with Check box as Key and another unique value column like "Unique Value"
Try
If Me.grdSample.ActiveCell.Column.Key = "Multi Value" Then
If Me.grdSample.ActiveCell.ValueList Is Nothing Then
Dim ogrid As Infragistics.Win.UltraWinGrid.UltraGrid = DirectCast(oControl, Infragistics.Win.UltraWinGrid.UltraGrid)
olROw.Cells("Check box").Value = False
Next
Else
Dim ogrid1 As Infragistics.Win.UltraWinGrid.UltraGrid = DirectCast(oControl1, Infragistics.Win.UltraWinGrid.UltraGrid)
Dim v As Infragistics.Win.ValueList = Nothing
For i As Integer = 0 To v.ValueListItems.Count - 1
If olROw.Cells("unique value").Value = DirectCast(DirectCast(v.ValueListItems.GetItem(i), System.Object), Infragistics.Win.ValueListItem).DataValue.ToString() Then
olROw.Cells("Check box").Value = True
End If
ExceptionManager.Publish(ex)
Finally
End Try
End Sub
Swetha,
Can you place smaple code? I am able to save the values through value list but i am unable to populate back once user dropdown same control.
Thanks-
Mike-
Thanks for ur help. I used value list property and got exactly what I want.
I don't know what you mean by that. The same DataSet has nothing to do with it as far as I can see.
This sample appears to be more of a starting point than a fully-functioning sample. There are lots of additional things you would probably want to do with it.
For one thing, when you select items from the list, the sample just puts the text of the last item into the cell. I would think you would probably want to set the cell value to something that indicates multiple items. Perhaps a comma-delimited string, or some custom text. Personally, I would probably make the column's data type a List<T> or something like that, so the value of the cell can actually contain multiple values. That would be a more useful scenario for a real application.
The way the ValueList works is that when you drop it down, it examines the value of the cell and selects the appropriate item. So you would have to code the same kind of thing here and initialize the state of each checkbox in the dropdown grid based on the current value of the cell. The best place to do this would be in the BeforeEditorButtonDropDown event. The odd thing is that this sample is actually handling this event, but not actually doing anything there.