Hello,
Edit: Sorry for topic name. Can't update it after posting.
I have RadMultiColumnComboBox in GridView.
I replace editor for that column like that:
and this is my custom class:
So basically when user edit cell, another grid (custom editor) will show and user can check few person. After editing value in that cell will be set like Person 1; Person 2; Person 3.
This all work just fine but i have problem with text in that cell when user is in edit mode.
After entering edit mode cell text automatically change to "False".
When user check some rows cell text also change according to checked state "False" or "True".
How to avoid that text changing?
I want see my current string (depend what was checked) "Person 1; Person 2; Person 3" in grid cell also in edit mode so will be always updated information.
I another words, how to control text displayed in cell when user is in edit mode?
Edit: Sorry for topic name. Can't update it after posting.
I have RadMultiColumnComboBox in GridView.
I replace editor for that column like that:
private
void
GridView_EditorRequired(
object
sender, EditorRequiredEventArgs e)
{
if
(e.EditorType ==
typeof
(RadMultiColumnComboBoxElement))
{
PersonChecker newEditor =
new
PersonChecker();
e.Editor = newEditor;
}
}
and this is my custom class:
public
class
PersonChecker : BaseInputEditor
{
public
override
object
Value
{
get
{
String all =
""
;
RadMultiColumnComboBoxElement editor = ((RadMultiColumnComboBoxElement)
this
.EditorElement);
foreach
(GridViewRowInfo gvri
in
editor.Rows)
{
if
(Convert.ToBoolean(gvri.Cells[0].Value) ==
true
)
{
if
(all !=
""
)
all +=
"; "
;
all += Convert.ToString(gvri.Cells[1].Value);
}
}
return
all;
}
set
{
Console.WriteLine(
"to do"
);
}
}
protected
override
RadElement CreateEditorElement()
{
RadMultiColumnComboBoxElement editor =
new
RadMultiColumnComboBoxElement();
editor.EditorControl.AutoGenerateColumns =
false
;
editor.Columns.Clear();
GridViewCheckBoxColumn check =
new
GridViewCheckBoxColumn();
check.HeaderText =
""
;
check.Name =
"Check"
;
check.MinWidth = 40;
check.MaxWidth = check.MinWidth;
check.ReadOnly =
false
;
editor.Columns.Add(check);
GridViewTextBoxColumn username =
new
GridViewTextBoxColumn();
username.HeaderText =
"Username"
;
username.Name =
"Username"
;
username.MinWidth = 200;
editor.Columns.Add(username);
editor.Rows.Clear();
editor.Rows.Add(
new
Object[] {
false
,
"Person 1"
});
editor.Rows.Add(
new
Object[] {
false
,
"Person 2"
});
editor.Rows.Add(
new
Object[] {
false
,
"Person 3"
});
//foreach (Person person in FormMain._persons)
//{
// editor.Rows.Add(
// new Object[] { false, person.SP_Username }
// );
//}
editor.EditorControl.ShowRowHeaderColumn =
false
;
editor.AutoSizeDropDownToBestFit =
true
;
editor.PopupClosing -= Editor_PopupClosing;
editor.PopupClosing += Editor_PopupClosing;
editor.EditorControl.CellClick -= EditorControl_CellClick;
editor.EditorControl.CellClick += EditorControl_CellClick;
return
editor;
}
private
void
EditorControl_CellClick(
object
sender, GridViewCellEventArgs e)
{
if
(e.ColumnIndex == 0 && e.RowIndex > -1)
{
e.Row.Cells[0].Value = !Convert.ToBoolean(e.Row.Cells[0].Value);
}
}
private
void
Editor_PopupClosing(
object
sender, RadPopupClosingEventArgs args)
{
if
(args.CloseReason == RadPopupCloseReason.Mouse)
{
args.Cancel =
true
;
}
}
public
override
void
BeginEdit()
{
base
.BeginEdit();
this
.EditorElement.Focus();
}
public
override
bool
EndEdit()
{
return
base
.EndEdit();
}
public
override
Type DataType
{
get
{
return
typeof
(
string
); }
}
}
So basically when user edit cell, another grid (custom editor) will show and user can check few person. After editing value in that cell will be set like Person 1; Person 2; Person 3.
This all work just fine but i have problem with text in that cell when user is in edit mode.
After entering edit mode cell text automatically change to "False".
When user check some rows cell text also change according to checked state "False" or "True".
How to avoid that text changing?
I want see my current string (depend what was checked) "Person 1; Person 2; Person 3" in grid cell also in edit mode so will be always updated information.
I another words, how to control text displayed in cell when user is in edit mode?