Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 11th, 2005, 11:47 PM
Friend of Wrox
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to set textbox property to readonly when text

Not familar with Asp but I am very familiar with ASP.NET.
When a database column, Status, has string ='enrolled' all the textboxes on the form (over 50 textbox) property should be readonly. What is the best way to do this?
Some examples please. Thank you

Old July 12th, 2005, 12:06 AM
Friend of Wrox
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41

I assume you mean textArea? Dont know if its the 'best way' but I would:

1..get records
2..Assign a true false state to variable:
dim disableTxtArea
disableTxtArea = false
IF rs("status") = "enrolled" then disableTxtArea = true END IF
3..Now assign it accordingly, EG:
<textArea <%if disableTxtArea then%> disabled <%end if%></textArea>

IMO disabled is better than read only. Read only does not dim the text, users think there is a problem on the page. Disabled dims the text and makes it clear that 'there is something different about these textAreas'.

You have the string 'enrolled' in a column, this is poor normalization. I would have a tables called status. Enrolled apears in there once and links to your main table, this way a single integer represents an enrolled status. This way you can add to the status tble using a cms page etc.....

Wind is your friend

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set the Text Property of Label Control via JavaScr AbrarNazeer Java Basics 0 August 24th, 2006 01:46 AM
Set the Text Property of Label Control via JavaScr AbrarNazeer ASP.NET 2.0 Professional 0 August 24th, 2006 01:41 AM
Can't set text property of dynamic text box sreerajrs ASP.NET 1.0 and 1.1 Professional 1 May 31st, 2006 09:39 PM
Set Default text in a textbox to whats in the prev marcin2k Access VBA 1 September 19th, 2005 08:55 AM
TextBox.Text property returns only old value? humour General .NET 9 August 3rd, 2004 07:01 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.