BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi Frank,
Thank you for your interest in Syncfusion products.
Query-1 How to use "Col1" as listbox, so I can choose only entries of the list? |
If you want to set the Column 1 style as Combobox or any other listbox control, you can use CellType property. Please make use of below code,
Code Snippet: Dim choiceList As StringCollection = New StringCollection
Note: If you want to set ListBox control to grid cell, you need to set celltype as control and assign that ListBox control to grid.
Code Snippet: Dim listBox As ListBox = New ListBox
|
Query-2 How to set the witdh of "Col1" |
The reported scenario with “Changing the column width” can be achieved by handling QueryColWidth event. Using this event, you can set column width for particular column.
Code Snippet: AddHandler Me.gridDataBoundGrid1.Model.QueryColWidth, AddressOf Me.Model_QueryColWidth Private Sub Model_QueryColWidth(ByVal sender As Object, ByVal e As GridRowColSizeEventArgs)
|
Query-3 How to get the value of column 'C', when I choose an entrie of the listbox? |
If you want to get the particular column value when selecting the entry in listbox or combobox, you can use CurrentCellCloseDropDown event. Using this event , you can get currently selected value from dropdown list using SelectedValue property of renderer.
Code Snippet: AddHandler Me.gridDataBoundGrid1.CurrentCellCloseDropDown, AddressOf Me.gridDataBoundGrid1_CurrentCellCloseDropDown
|
Please let me know if you have any concerns.
Regards,
Neelakandan
Hi Frank,
Thank you for your interest in Syncfusion products.
Query-1
How to use "Col1" as listbox, so I can choose only entries of the list?
If you want to set the Column 1 style as Combobox or any other listbox control, you can use CellType property. Please make use of below code,
Code Snippet:
Dim choiceList As StringCollection = New StringCollection
choiceList.Add("Item1")
choiceList.Add("Item2")
Me.gridDataBoundGrid1.Model.ColStyles(1).CellType = GridCellTypeName.ComboBox
Me.gridDataBoundGrid1.Model.ColStyles(1).ChoiceList = choiceList
Note:
If you want to set ListBox control to grid cell, you need to set celltype as control and assign that ListBox control to grid.
Code Snippet:
Dim listBox As ListBox = New ListBox
listBox.Items.Add("Item1")
listBox.Items.Add("Item2")
Me.gridDataBoundGrid1.Model.ColStyles(1).CellType = GridCellTypeName.Control
Me.gridDataBoundGrid1.Model.ColStyles(1).Control = listBox
Query-2
How to set the witdh of "Col1"
The reported scenario with “Changing the column width” can be achieved by handling QueryColWidth event. Using this event, you can set column width for particular column.
Code Snippet:
AddHandler Me.gridDataBoundGrid1.Model.QueryColWidth, AddressOf Me.Model_QueryColWidth
Private Sub Model_QueryColWidth(ByVal sender As Object, ByVal e As GridRowColSizeEventArgs)
If (e.Index = 1) Then ‘Specify your needed column index
e.Size = 200
e.Handled = true
End If
End Sub
Query-3
How to get the value of column 'C', when I choose an entrie of the listbox?
If you want to get the particular column value when selecting the entry in listbox or combobox, you can use CurrentCellCloseDropDown event. Using this event , you can get currently selected value from dropdown list using SelectedValue property of renderer.
Code Snippet:
AddHandler Me.gridDataBoundGrid1.CurrentCellCloseDropDown, AddressOf Me.gridDataBoundGrid1_CurrentCellCloseDropDown
Private Sub gridDataBoundGrid1_CurrentCellCloseDropDown(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.PopupClosedEventArgs)
If (TypeOf Me.gridDataBoundGrid1.CurrentCell.Renderer Is GridDropDownGridListControlCellRenderer) Then
Dim renderer As GridDropDownGridListControlCellRenderer = CType(Me.gridDataBoundGrid1.CurrentCell.Renderer,GridDropDownGridListControlCellRenderer)
Dim selectedValue As String = renderer.ListControlPart.SelectedValue.ToString
MessageBox.Show(Me.gridDataBoundGrid1.Model(Me.gridDataBoundGrid1.CurrentCell.RowIndex, (Me.gridDataBoundGrid1.CurrentCell.ColIndex + 2)).CellValue.ToString) ’specify your needed column index for particular column value
End If
End Sub
Please let me know if you have any concerns.
Regards,
Neelakandan
Attachment: Sample_GDBC_VB_d02e0fb4.zip
Hi Frank,
Thank you for your update.
Query-1 How to use "Col1" as listbox, so I can choose only entries of the list? |
If you want to restrict the ComboBoxCell being edited, you can use CurrentCellKeyPress event. You can cancel KeyPress event by enabling Handled property.
Code Snippet: AddHandler Me.gridDataBoundGrid1.CurrentCellKeyPress, AddressOf Me.gridDataBoundGrid1_CurrentCellKeyPress Private Sub gridDataBoundGrid1_CurrentCellKeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) |
Query-2 How to set the width of "Col1" |
The column width of the ComboBox dropdown container can be changed by using DefaultColWidth or Colwidths properties of Grid. DefaultColWidth property is used to set all the columns with same widths. Using ColWidths property, you can specify your needed columns to change width.
Code Snippet: Private Sub gridDataBoundGrid1_CurrentCellShowedDropDown(ByVal sender As Object, ByVal e As EventArgs) |
Query-3 How to get the value of column 'C', when I choose an entrie of the listbox? |
We analyzed your customization at our end. It seems that you are using Rows property to get items. But SelectedItem property does not contain any extension like Row. So that we need some more details regarding your customization. It would be more helpful if you provide any simple sample or you also modify our sample to reproduce. |
Note:
If you have still an issue, please create Direct-Trac incident. It would be better follow up.
You can create the DT incident from the following link.
<http://www.syncfusion.com/account/dashboard>
Please let me know if you have any concerns.
Regards,
Neelakandan
Hi Frank,
Thank you for your update.
Query-1 It's allways possible to insert anything with 'Ctr+C' |
The reported scenario can be resolved by handling CurrentCellKeyDown event. Please make use of below code,
Code Snippet: Private Sub gridDataBoundGrid1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
|
Query-2 It works not until the second dropdown done.
|
The dropdown container size can be changed by using Size property of CurrentCellShowingDropDown event. Please make use of below code,
Code Snippet: Private Sub gridDataBoundGrid1_CurrentCellShowingDropDown(ByVal sender As Object, ByVal e As GridCurrentCellShowingDropDownEventArgs) CurrentCell.Renderer,GridDropDownGridListControlCellRenderer) renderer.ListControlPart.Grid.Model.ColCount) + 200), renderer.ListControlPart.Grid.RowHeights.GetTotal(0, renderer.ListControlPart.Grid.Model.RowCount))
//Specify your needed size
|
Please let me know if you have any concerns.
Regards,
Neelakandan
Hi Frank,
Thank you for your update.
We are glad to hear from you that the scenario is resolved.
Please let us know if you need further assistance on this.
Regards,
Neelakandan