Rangadurai
Top achievements
Rank 1
Rangadurai
asked on 02 Sep 2012, 04:49 PM
i added the combobox column in gridview. Have to load the combobox values based on the criteria. That criteria value comes from another cell of the grid.Please help me on this.(urgent)
Have to bind different datasource for each row combobox column in the grid.
thanks for support.
Have to bind different datasource for each row combobox column in the grid.
thanks for support.
6 Answers, 1 is accepted
0
Hi,
Thank you for writing.
Please refer to the following help article which demonstrates how you can change the combo box cell data source according to the value of another cell: http://www.telerik.com/support/kb/winforms/gridview/radcomboboxeditor-in-gridviewcomboboxcolumn-dependant-on-the-value-of-another-cell.aspx.
Please note, that in all cases the column's DataSource should contain all values that will be shown in the column's cells i.e. if you have a grid with three rows, the first one displays items 1-2, the second one 3-6 and the third one 6-10, the column's DataSource should contain all 1-10 values in it.
I hope this helps.
All the best,
Stefan
the Telerik team
Thank you for writing.
Please refer to the following help article which demonstrates how you can change the combo box cell data source according to the value of another cell: http://www.telerik.com/support/kb/winforms/gridview/radcomboboxeditor-in-gridviewcomboboxcolumn-dependant-on-the-value-of-another-cell.aspx.
Please note, that in all cases the column's DataSource should contain all values that will be shown in the column's cells i.e. if you have a grid with three rows, the first one displays items 1-2, the second one 3-6 and the third one 6-10, the column's DataSource should contain all 1-10 values in it.
I hope this helps.
All the best,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Rangadurai
Top achievements
Rank 1
answered on 03 Sep 2012, 04:36 PM
Hi Stefan,
Thanks for your prompt reply.
I using the below code for dynamic combo column in grid. i tried the below code in cellEditiorinitialized event and cellbeginedit event. i not get desired result .when i select the comboboxcolumn then another row comboboxcolumn value disappeared. Please help me on this.this is important functionality for us.
Have look attached file.
Private Sub gv_CPS_CellEditorInitialized(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles gv_CPS.CellEditorInitialized
If CType(gv_CPS.CurrentColumn, GridViewDataColumn).Name = "MOLD NAME" Then
If (Not IsDBNull(e.Row.Cells("MOLD_TYPE_ID").Value)) Then
CType(gv_CPS.CurrentColumn, GridViewComboBoxColumn).DataSource = objCom.Dynamic_Combo_load("A.mold_type_id", "A.Name", " T_SFS_MOLD_TYPE A, T_SFS_BENCH_MOLD B WHERE A.PLANT_CODE = B.PLANT_CODE And A.MOLD_TYPE_ID = B.MOLD_TYPE_ID AND B.BENCH_ID = " + e.Row.Cells("BENCH_ID").Value.ToString() + " AND A.PLANT_CODE ='" + cmb_Plant.SelectedValue + "' ORDER BY NAME")
CType(gv_CPS.CurrentColumn, GridViewComboBoxColumn).ValueMember = "mold_type_id"
CType(gv_CPS.CurrentColumn, GridViewComboBoxColumn).DisplayMember = "Name"
End If
End If
End Sub
Thanks for your prompt reply.
I using the below code for dynamic combo column in grid. i tried the below code in cellEditiorinitialized event and cellbeginedit event. i not get desired result .when i select the comboboxcolumn then another row comboboxcolumn value disappeared. Please help me on this.this is important functionality for us.
Have look attached file.
Private Sub gv_CPS_CellEditorInitialized(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles gv_CPS.CellEditorInitialized
If CType(gv_CPS.CurrentColumn, GridViewDataColumn).Name = "MOLD NAME" Then
If (Not IsDBNull(e.Row.Cells("MOLD_TYPE_ID").Value)) Then
CType(gv_CPS.CurrentColumn, GridViewComboBoxColumn).DataSource = objCom.Dynamic_Combo_load("A.mold_type_id", "A.Name", " T_SFS_MOLD_TYPE A, T_SFS_BENCH_MOLD B WHERE A.PLANT_CODE = B.PLANT_CODE And A.MOLD_TYPE_ID = B.MOLD_TYPE_ID AND B.BENCH_ID = " + e.Row.Cells("BENCH_ID").Value.ToString() + " AND A.PLANT_CODE ='" + cmb_Plant.SelectedValue + "' ORDER BY NAME")
CType(gv_CPS.CurrentColumn, GridViewComboBoxColumn).ValueMember = "mold_type_id"
CType(gv_CPS.CurrentColumn, GridViewComboBoxColumn).DisplayMember = "Name"
End If
End If
End Sub
0
Accepted
Hello,
Thank you for writing back.
Such a behavior is not applicable in the KB article's projects and should not happen out of the box. Basically, you check some other column value in order to know which data source to apply to the currently edited combo. The CellEditorInitialized event is the right place to do so.
If you continue experiencing issues, please get back to me with a striped version of your project and data and let me know exactly how should I proceed in order to reproduce the issue in your project. This will allow me to investigate it and help you with it.
I am looking forward to your reply.
Regards,
Stefan
the Telerik team
Thank you for writing back.
Such a behavior is not applicable in the KB article's projects and should not happen out of the box. Basically, you check some other column value in order to know which data source to apply to the currently edited combo. The CellEditorInitialized event is the right place to do so.
If you continue experiencing issues, please get back to me with a striped version of your project and data and let me know exactly how should I proceed in order to reproduce the issue in your project. This will allow me to investigate it and help you with it.
I am looking forward to your reply.
Regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Rangadurai
Top achievements
Rank 1
answered on 09 Sep 2012, 02:20 PM
Hi Stefan,
thanks for your valuable suggestion. Now it's working.thanks lot.
thanks for your valuable suggestion. Now it's working.thanks lot.
0
Rangadurai
Top achievements
Rank 1
answered on 13 Sep 2012, 06:33 PM
Hi Stefan,
How to use the selected index changed event in gridview comboboxcolumn.
How to use the selected index changed event in gridview comboboxcolumn.
0
Hello Rangadurai,
Thank you for writing back.
I would like to suggest to subscribe to the SelectedIndexChanged event in the CellEditorInitialized event. For example:
I hope this helps.
Greetings,
Peter
the Telerik team
Thank you for writing back.
I would like to suggest to subscribe to the SelectedIndexChanged event in the CellEditorInitialized event. For example:
private
void
radGridView1_CellEditorInitialized(
object
sender, GridViewCellEventArgs e)
{
RadDropDownListEditor editor = e.ActiveEditor
as
RadDropDownListEditor;
if
(editor !=
null
)
{
RadDropDownListEditorElement element = editor.EditorElement
as
RadDropDownListEditorElement;
element.SelectedIndexChanged-=
new
SelectedIndexChangedEventHandle(element_SelectedIndexChanged);
element.SelectedIndexChanged+=
new
SelectedIndexChangedEventHandle(element_SelectedIndexChanged);
}
}
I hope this helps.
Greetings,
Peter
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>