5 Answers, 1 is accepted
0

Emanuel Varga
Top achievements
Rank 1
answered on 08 Sep 2011, 07:43 AM
Hello Jose,
Could you please try to be a bit more clear on what you are trying to accomplish?
Best Regards,
Emanuel Varga
Could you please try to be a bit more clear on what you are trying to accomplish?
Best Regards,
Emanuel Varga
0

Jose
Top achievements
Rank 1
answered on 08 Sep 2011, 08:29 AM
Hello:
i want that the combobox of the grid (in the zone "click here to add a new row") shows a default value.
For example, the combobox column of my grid shows all of users of my application. When the application starts, the user have to log in with username and password. Then, if the user goes to the grid, i want that the combobox column of the grid shows the username logged by default (before editing grid in the "adding row zone").
Thanks a lot.
i want that the combobox of the grid (in the zone "click here to add a new row") shows a default value.
For example, the combobox column of my grid shows all of users of my application. When the application starts, the user have to log in with username and password. Then, if the user goes to the grid, i want that the combobox column of the grid shows the username logged by default (before editing grid in the "adding row zone").
Thanks a lot.
0
Accepted

Emanuel Varga
Top achievements
Rank 1
answered on 08 Sep 2011, 11:44 AM
Hello Jose,
You just need to handle the CellEditorInitialized event and perform some of the following checks there:
and inside you can set whatever you want to the editorElement.SelectedText or SelectedItem or anything you would normally do to select an item if you had access to the dropdown itself.
Best Regards,
Emanuel, Varga
You just need to handle the CellEditorInitialized event and perform some of the following checks there:
void
radGridView1_CellEditorInitialized(
object
sender, GridViewCellEventArgs e)
{
if
(e.Row
is
GridViewNewRowInfo)
{
if
(e.ColumnIndex == 0)
{
var editor = e.ActiveEditor
as
RadDropDownListEditor;
if
(editor ==
null
)
{
return
;
}
var editorElement = editor.EditorElement
as
RadDropDownListEditorElement;
editorElement.SelectedIndex = 12;
}
}
}
and inside you can set whatever you want to the editorElement.SelectedText or SelectedItem or anything you would normally do to select an item if you had access to the dropdown itself.
Best Regards,
Emanuel, Varga
0

Jose
Top achievements
Rank 1
answered on 08 Sep 2011, 12:27 PM
Thanks a lot Emmanuel
0
Accepted

Emanuel Varga
Top achievements
Rank 1
answered on 08 Sep 2011, 12:29 PM
Glad to be able to help,
If you have any more questions please just let me know, and if the question has been solved, please mark the question as answered, so that others can find the answers to their questions faster.
Best Regards,
Emanuel Varga
WinForms MVP
If you have any more questions please just let me know, and if the question has been solved, please mark the question as answered, so that others can find the answers to their questions faster.
Best Regards,
Emanuel Varga
WinForms MVP