Hi!
In C#, is it possible to get a bool value, determining if the cursor is currently inside a certain textbox?
What I want to achieve:
I have a masterpage, with two buttons in it; a search-button and a login-button. Depending on what textbox is active or has focus, or of none have focus, I want to set the UseSubmitBehavior-attribute.
What I want to happen is something like this (I know this code doesn't work):
if (textboxUsername.hasfocus == true || textboxPassword.hasfocus == true)
{
buttonLogin.UseSubmitBehavior = true;
buttonSearch.UseSubmitBehavior = false;
}
else
{
buttonLogin.UseSubmitBehavior = false;
buttonSearch.UseSubmitBehavior = true;
}
The goal is to make the page react the way the user expect it to, e.g. actually searching when hitting enter, and not trying to login, when you are typing in the search-field.