Reputation: 159
Using this code within an aspx file
<% if(storeid=1) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-abcd.js" async defer></script>
<% } %>
<% else if(storeid=2) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-efgh.js" async defer></script>
<% } %>
<% else if(storeid=3) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-ijklmn.js" async defer></script>
<% } %>
<% else if(storeid=4) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-opqrs.js" async defer></script>
<% } %>
Compiling this gives me this error
Compiler Error Message: CS1525: Invalid expression term '<'
Source Error:
Line 62:
Line 63: // Specific Code test 17.4.2014
Line 64: <% if(storeid=1) { %>
Line 65: <script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-abcd.js" async defer> </script>
Line 66: <% } %>
All of the <% and %> look ok. Where is it falling down?
Upvotes: 0
Views: 9065
Reputation: 13003
Replace this line:
<% if(storeid=1) { %>
With:
<% if( storeid == 1 ) { %>
By the way, this is true for all of the rest equality checks in the other lines of code.
Upvotes: 4
Reputation: 10865
Your storeid='1' is wrong and the rest of your else statement. it should be ==
.
storeid == 1
and not storeid=1
.
<% if(storeid=1) { %>
should be
<% if(storeid==1) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-abcd.js" async defer></script>
<% } %>
<% else if(storeid==2) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-efgh.js" async defer></script>
<% } %>
<% else if(storeid==3) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-ijklmn.js" async defer></script>
<% } %>
<% else if(storeid==4) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-opqrs.js" async defer></script>
<% } %>
Upvotes: 3