or
| private void radGridView1_CurrentRowChanging(object sender, CurrentRowChangingEventArgs e) |
| { |
| if (e.CurrentRow == null) return; |
| radGridView1.Invalidate(); |
| var val = Convert.ToString(e.CurrentRow.Cells["column1"].Value); |
| if (val == "test") |
| { |
| MessageBox.Show("Invalid data"); |
| e.Cancel = true; |
| } |
| } |
I have created a class which inherits from RADTextBox and override the OnKeyPress() method.
public class RegExpRadTextBox : RadTextBox
{
string _keyRegExp;
public string KeyRegExp
{
get { return this._keyRegExp; }
set { this._keyRegExp = value; }
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (!string.IsNullOrEmpty(this._keyRegExp))
{
if (!Regex.IsMatch(e.KeyChar.ToString(), this._keyRegExp))
{
e.Handled = true;
}
}
base.OnKeyPress(e);
}
}
But when i type some text, nothing happens (Keypress Event Firing/Raised).
(Keydown is also doesnt work.)
What should i do?
Thanks.