Showing posts with label enable. Show all posts
Showing posts with label enable. Show all posts

Monday, March 26, 2012

Text in textbox enables button.

Hello beginner here.
I've been researching for awhile to find a way to enable a button when
text is entered into a textbox (client side). I working with asp.net
2.0 C#. I've been trying to figure this out through javascript or
someone told me to research Page.RegisterClientScriptBlock Method, but
I can't seem to figure this out. Any help will be appreciated.

ThanksHey.

in your html:
<script>
function blah(textbox,button)
{
button.disabled = textbox.value.length == 0;
}
</script>

in your C# (in page load handler or wherever):

...
this.txtBox.Attributes["onkeyup"] =
string.Format("blah(this,getElementByID('{0}'));",this.btnSubmitOrWhateverItsNameIs.ClientID);
...

Hope this helps.
Kikoz

<hledman@.gmail.comwrote in message
news:1154459595.292991.267130@.i42g2000cwa.googlegr oups.com...

Quote:

Originally Posted by

Hello beginner here.
I've been researching for awhile to find a way to enable a button when
text is entered into a textbox (client side). I working with asp.net
2.0 C#. I've been trying to figure this out through javascript or
someone told me to research Page.RegisterClientScriptBlock Method, but
I can't seem to figure this out. Any help will be appreciated.
>
Thanks
>