I have a radGridView (2014.2.715.40) component having among others 2 checkbox columns. One is named "IsConcilie" and the other one is "IsRetenu". For each row, when 1 of these columns is true, we can't set the other one to true. Only one of these 2 columns may be true at a time. If the user tries to put the second to true, he is advised. The radGridView is named "MasterTemplate".
Because I want to be able to cancel the action, I added this event handler:
this.MasterTemplate.ValueChanging += new ValueChangingEventHandler(MasterTemplate_ValueChanging);
Then I coded the following:
void MasterTemplate_ValueChanging(object sender, ValueChangingEventArgs e)
{
GridDataCellElement ce = this.MasterTemplate.CurrentCell;
if (ce.Name == "IsConcilie")
{
if (e.NewValue.Equals(false)) return;
if (this.MasterTemplate.CurrentRow.Cells["IsRetenu"].Equals(true))
{
MessageBox.Show( "You cannot verify a retained cheque", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
e.Cancel = true;
}
}
if (ce.Name == "IsRetenu")
{
if (e.NewValue.Equals(false)) return;
if (this.MasterTemplate.CurrentRow.Cells["IsConcilie"].Equals(true))
{
MessageBox.Show("You cannot retain a verified cheque", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
e.Cancel = true;
}
}
}
Unfortunately, whenever we click one of these checkboxes, the event is not fired. What's wrong?
Thanks.
Because I want to be able to cancel the action, I added this event handler:
this.MasterTemplate.ValueChanging += new ValueChangingEventHandler(MasterTemplate_ValueChanging);
Then I coded the following:
void MasterTemplate_ValueChanging(object sender, ValueChangingEventArgs e)
{
GridDataCellElement ce = this.MasterTemplate.CurrentCell;
if (ce.Name == "IsConcilie")
{
if (e.NewValue.Equals(false)) return;
if (this.MasterTemplate.CurrentRow.Cells["IsRetenu"].Equals(true))
{
MessageBox.Show( "You cannot verify a retained cheque", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
e.Cancel = true;
}
}
if (ce.Name == "IsRetenu")
{
if (e.NewValue.Equals(false)) return;
if (this.MasterTemplate.CurrentRow.Cells["IsConcilie"].Equals(true))
{
MessageBox.Show("You cannot retain a verified cheque", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
e.Cancel = true;
}
}
}
Unfortunately, whenever we click one of these checkboxes, the event is not fired. What's wrong?
Thanks.