CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Change Control Type with a data field value

Print topic Send  topic

Author Message
David
Posted: 12/29/2004, 8:32 AM

I want to be able to change a text box to a label on the fly if a value within that record contains a specific value. Can this be done and if so, how? thanks for your time in this matter.
peterr


Posts: 5971
Posted: 12/29/2004, 2:21 PM

You may try creating both, then hide the textbox when it is not needed and popuate the label instead.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
David
Posted: 12/30/2004, 12:41 PM

Why that is an excellent Idea. I will give a shot.
Benjamin Krajmalnik
Posted: 12/30/2004, 1:46 PM

David,

In such instances I create both controls on the form and conditionally hide
the one I do not want to use.
Works like a charm.

David
Posted: 01/13/2005, 9:13 AM

I have managed to accomplish this by using the suggestion above. But I am having a problem

This is my scenario.....

I have an application that allows technician to log trouble tickets. There is a status of the trouble tickets (i.e. closed, new, in progress) There are fields that need to be updated while the status is everything but "closed". I used the suggestion above to then display labels of the data when the status is closed which in turn hides the text boxes. My problem is that the Status indicator is always active to allow then to "reopen" a ticket. When the form is displayed with a "closed" status it hides the text box and displays the label containing the data (perfect!) but if they need to reopen the ticket (select a new status and click submit) it then deletes all the other data contained in the hidden text boxes. Does this make sense or I am confusing everyone..... I would appreciate any ideas or help you can provide.

thanks.
peterr


Posts: 5971
Posted: 01/14/2005, 12:42 AM

David,
May I ask how are you hiding those TextBoxes?

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
peterr


Posts: 5971
Posted: 01/14/2005, 1:18 AM

Actually I'm not sure yet if the method of hiding textboxes (usually Visible = false) is relevant. I'm just not sure if or why hiding a textbox automatically clears its value.
If no one else proposes a solution, a workaround could be to add Hidden fields in addition to TextBoxe fields and assign TextBox values to the Hidden fields' values. Hidden fields are usually used to preserve some information that isn't visible. The Control Source property for the Hidden fields would need to be the same as for the TextBoxes.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
David
Posted: 01/14/2005, 6:09 AM

Peter
Thanks for the suggestion...I always value your input. I am using the visible = false method for hiding the text box. My only concern with your suggestions is that if the status is not closed (which means the text boxes are visible) and they enter or change the values in the text box, the hidden box would then overide the values they enter into the active textbox.... Am I right in my assumption?

I also don't understand why making the text "visible=false" would screw up the update statement in which it updates the field with blank values.....
peterr


Posts: 5971
Posted: 01/14/2005, 9:43 AM

I didn't have time to test yet if that is field values are blank when you hide a textbox. There could be a simpler issue and solution than we're assuming.
As for the last workaround, I see that it is getting more complex than it should, but the problem you described could be prevented in the Before Update event, by assigning the TextBox values to Hidden values. And vice-versa if the TextBox was hidden.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.