Arkadaşlar merhaba,
Üye kayıt formunda Ad Soyad texbox içeriğine sadece harf girilsin istiyorum.
Bunu ;
function HarfKontrol(e) {
giris = document.all ? window.event : e;
tus = document.all ? giris.keyCode : giris.which;
if (tus >= 47 && tus <= 57) {
if (document.all) { giris.returnValue = false; } else { giris.preventDefault(); }
}
}
koldarıyla sağladım ama sadece Internet Explorer da çalışmakta.
Google Chrome, Mozilla gibi diğer tarayıcılarda bir etkisi olmuyor.
yaptığım araştırmalarda textbox keypressEvent a yazılması gereken
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsLetter(e.KeyChar) && !char.IsControl(e.KeyChar) && !char.IsSeparator(e.KeyChar);
}
kodları eklediğim zaman handled ve KeyChar altını çiziyor ve
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
ile karşılaşmaktayım. Textbox içerisine sadece harf girilmesini nasıl sağlayabilirim.
Bu konuda yardımcı olabilirseniz sevinirim.
Üye kayıt formunda Ad Soyad texbox içeriğine sadece harf girilsin istiyorum.
Bunu ;
function HarfKontrol(e) {
giris = document.all ? window.event : e;
tus = document.all ? giris.keyCode : giris.which;
if (tus >= 47 && tus <= 57) {
if (document.all) { giris.returnValue = false; } else { giris.preventDefault(); }
}
}
koldarıyla sağladım ama sadece Internet Explorer da çalışmakta.
Google Chrome, Mozilla gibi diğer tarayıcılarda bir etkisi olmuyor.
yaptığım araştırmalarda textbox keypressEvent a yazılması gereken
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsLetter(e.KeyChar) && !char.IsControl(e.KeyChar) && !char.IsSeparator(e.KeyChar);
}
kodları eklediğim zaman handled ve KeyChar altını çiziyor ve
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
ile karşılaşmaktayım. Textbox içerisine sadece harf girilmesini nasıl sağlayabilirim.
Bu konuda yardımcı olabilirseniz sevinirim.