CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Conditionally Change Color Problem

Print topic Send  topic

Author Message
slynch401k

Posts: 15
Posted: 10/08/2006, 9:38 AM

I am having trouble referring to a lable in C#. The lable is in a grid with the name "vEmployeeFullNameStatus". I want to change the text color on a condition.

I followed the directions in the manual for "Changing Text Color". Here is the error that I get back.

Compiler Error Message: CS0103: The name 'vEmployeeFullNameStatus' does not exist in the current context.

My code is as follows:

/Label Status Event BeforeShow. Action Custom Code @26-2A29BDB7
// -------------------------
if (vEmployeeFullNameStatus.Text == "MAIL RESTRICTION") {
vEmployeeFullNameStatus.Text = "<font color=RED>"+vEmployeeFullNameStatus.Text+"</font>";
} else if (vEmployeeFullNameStatus.Text == "DOCUMENT RESTRICTION") {
vEmployeeFullNameStatus.Text = "<font color=GREEN>"+vEmployeeFullNameStatus.Text+"</font>";
}

// -------------------------
//End Label Status Event BeforeShow. Action Custom Code

I quess that I am not referring to the control properly. Any help would be appreciated.

Thank you.


View profile  Send private message
peterr


Posts: 5971
Posted: 10/08/2006, 12:18 PM

The manual explains that there is "a Grid called Tasks which has a Label field called Priority" and the syntax is "TasksPriority.Text".
Thus your syntax will also need to include the grid name.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
slynch401k

Posts: 15
Posted: 10/08/2006, 2:00 PM

Peter:

Thanks for the reply. The grids name is vEmployeeFullName and the lable in the grid is Status. So I think that I have it right.

Any other ideas?

Thanks
View profile  Send private message
Stan
Posted: 10/09/2006, 12:07 AM

You can check the name of the Label a few lines above. The line should look like following

System.Web.UI.WebControls.Literal <FormName><ControlName> = (System.Web.UI.WebControls.Literal)(e.Item.FindControl("<FormName><ControlName>"));

But name is indeed must be <FormName><ControlName>
slynch401k

Posts: 15
Posted: 10/10/2006, 3:50 PM

Stan and Peter Thank you.

The problem was that I had my database field set to nvar(25) so on my line if (vEmployeeFullNameStatus.Text == "MAIL RESTRICTION") { I needed to add trailing spaces to bring it up to 25 characters and it works.

For future reference do you know if there is something like a trim feature like:

if (TRIM)vEmployeeFullNameStatus.Text) == "MAIL RESTRICTION") {

I'm coming from an access vba backgrown, so I guess I will look it up in my C# book, but thought I would post for the benefit of the forum.

View profile  Send private message
slynch401k

Posts: 15
Posted: 10/10/2006, 4:45 PM

Figured it out, changed type in SQL from NVAR to NVARCHAR.
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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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