how make a textbox enabled false without postbac k

P

Patrick.O.Ige

I have a textbox and a submit button on a page,
I want the user to type in some characters before i enable or make the
submit button visible
<asp:TextBox id="txt" autopostback="true" runat="server" Width="70%"
Rows="4" TextMode="MultiLine"></asp:TextBox>


I used the ontextChnaged event

private void onchange(object sender, System.EventArgs e)
{
if (txtEquivalentRequirement.Text.Length > 0)
{
btnUpdate.Enabled = true;
}
else
{
btnUpdate.Enabled = false;
}

}

But this has to do a postback.
Is there a way i can do this without postback
Any ideas
 
P

Patrick.O.Ige

Yes i know i should be able to use js for that
But any samples ? if not then i would have to bring up something
Thx
 
M

Mark Rae

Yes i know i should be able to use js for that
But any samples ? if not then i would have to bring up something

Tsk! Tsk! Patrick... :)

<form id="frmDefault" method="post" runat="server">
<input type=text id=txtInput
onkeyup="document.getElementById('cmdButton').disabled =
(document.getElementById('txtInput').value.length == 0);">
<input type=button id=cmdButton value="Test">
</form>
 
B

Bruce Barker

note: if clientscript disables the control, the browser will not post it, so
the server will see the value.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top