Solved

IF display not working

Posted on 2013-10-28
11
250 Views
Last Modified: 2013-10-28
I am using classic ASP / javascript

I have the following lines:

<% if ((Permissions.SecBillingedit)== "True") { %>

VALUE
 
<% } // end Permissions.EOF && Permissions.BOF %>

It should display the value when 'secbillingedit' is equal to "True", but it doesnt. What is wrong ?

If I display the value of the field in on my screen  I get "True" ... so not sure what may be wrong.
0
Comment
Question by:amucinobluedot
  • 5
  • 5
11 Comments
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 500 total points
ID: 39605625
if the database field is a boolean type, you just want to do:

<% if ( Permissions.SecBillingedit ) { %>

your original code is comparing the field to a string value of "True", not a boolean value
0
 
LVL 16

Expert Comment

by:Brian Pringle
ID: 39605630
The <% and %> should be around the entire if statement, not each line.
0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 500 total points
ID: 39605644
no, thats inccorect. The <% %> can (and should be) on each line, especially if the part where the OP has VALUE is straight up html
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

Author Comment

by:amucinobluedot
ID: 39605645
Did not work. Nothing is displayed. It shoud compare and make sure the boolean value is '1' .. in the database it shows '1', but when displayed on the ASP page it shows "True"
0
 

Author Comment

by:amucinobluedot
ID: 39605648
The logic is correct, the 'value' or code I want to display is still not being displayed.

This is the complete code :

<% if ((Permissions.SecBillingedit)== "1") { %>

                          <a href="BillingItemsEdit.asp?ItemId=<%=(BillingItems.Fields.Item("Id").Value)%>&caseid=<%=(Casesjoin.Fields.Item("Id").Value)%>"><img src="../../Images/iedit.gif" width="16" height="16" border="0"></a>
                           
<% } // end Permissions.EOF && Permissions.BOF %>

I have tried and doesnt work with:

<% if ((Permissions.SecBillingedit)== "1") { %>
<% if ((Permissions.SecBillingedit)== "True") { %>
<% if ((Permissions.SecBillingedit)== '1') { %>
<% if ((Permissions.SecBillingedit)== 'True') { %>
0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 500 total points
ID: 39605653
then try comparing it to 1 then:

if ((Permissions.SecBillingedit)== 1))
0
 

Author Comment

by:amucinobluedot
ID: 39605668
Tried that, no go. Nothing is displayed.
0
 

Author Comment

by:amucinobluedot
ID: 39605680
Close enough, this worked:

<% if (Permissions('SecBillingedit')== "1") { %>
0
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 39605681
just to confirm, the database field "SecBillingedit" IS of a boolean type?

are you referencing that field any where else on the page?
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39605684
excellent! glad you got it working :)
0
 

Author Closing Comment

by:amucinobluedot
ID: 39605702
:)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question