>I am using this code to add an onkeypress attribute to a textbox control on a form:
>
>
> loControlTextboxUsername.Attributes.Add("onkeypress", "return FormLoginFromInput(event)")
>
>
>However, on Mozilla Firefox, the attribute does not get added. So, this means .NET is smart enough to detect the browser and ignore that line. Or, is there something I am missing?
>
>And, if that is the case, then, what kind of approach should I use to make sure this will be added on all browsers or how to have it compliant with all browsers?
Are you sure the method is called OnKeyPress? I don't recall exactly, but AFAIK it's something else like OnKeyCode... (Don't have this book with me right now).
If it's not broken, fix it until it is.
My Blog