Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Enable a button when all three text boxes are filled data

1 view
Skip to first unread message

aspfun via DotNetMonster.com

unread,
Feb 25, 2010, 9:44:36 AM2/25/10
to
In a web page, there are three text boxes and one button (enable=false).

When page load, I used javascrip to paste some info to fill out three text
boxes from clipboard in which another program will copy to.

How to code to make the button enable = true only when all thee text boxes
are filled?

I tried to add code below at end of page_load but do not work.

if textbox1.text <> "" and textbox2.text <> "" and textbox3.text <> "" then
button1.enable = true

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net-web-controls/201002/1

Nathan Sokalski

unread,
Feb 25, 2010, 6:42:38 PM2/25/10
to
First of all, do you want to do this check client or server side? It sounds
like something that you would want to do client-side using JavaScript. If
you do it server-side in the Load event, the values of the TextBoxes' Text
properties must be set before doing the check, and the Button's status will
not change once the Page is rendered (unless you have something other
client-side code that changes the Button's status). Please clarify exactly
what you want.
--
Nathan Sokalski
njsok...@hotmail.com
http://www.nathansokalski.com/

"aspfun via DotNetMonster.com" <u53138@uwe> wrote in message
news:a42a343c6e1be@uwe...

ahmed k

unread,
Sep 24, 2010, 11:39:56 PM9/24/10
to
its looking old now bt for those searching still on this thread

create method/function seperatly i call it "ckFields()"

Private Sub ckFields()


if textbox1.text <> "" and textbox2.text <> "" and textbox3.text <> "" then

Button1.Enabled = True
Else
Button1.Enabled = False
End If
End Sub

'Set AutoPostBack="true" for all textboxes
'now call method/function on EVERY textBox's Text change Event

Protected Sub textbox1_TextChanged(ByVal...)
ckFields()
End Sub

Protected Sub textbox2_Te...
Protected Sub textbox3_Te... and so on..

This might help
Thank you


>> On Thursday, February 25, 2010 6:42 PM Nathan Sokalski wrote:

>> First of all, do you want to do this check client or server side? It sounds
>> like something that you would want to do client-side using JavaScript. If
>> you do it server-side in the Load event, the values of the TextBoxes' Text
>> properties must be set before doing the check, and the Button's status will
>> not change once the Page is rendered (unless you have something other
>> client-side code that changes the Button's status). Please clarify exactly
>> what you want.
>> --
>> Nathan Sokalski
>> njsok...@hotmail.com
>> http://www.nathansokalski.com/


>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>> Simple .NET HEX PixelColor Utility
>> http://www.eggheadcafe.com/tutorials/aspnet/5617a491-963d-4510-b8f1-1863ddf52bc1/simple-net-hex-pixelcolor-utility.aspx

0 new messages