1
votes

i have a default.aspx

and a sidebar.aspx

i included the sidebar in my default by :

<!--#include file="../sidebar.aspx"-->  

it included successfully without any error i used this code in my sidbar file :

<% if (True) { %>
    <div class="left-box">
        ....
    </div>
<% } %>

it works fine when i refresh the page @ development server but vs 2010 shows compile error :

Error 25 End of statement expected. C:\Users\user\Documents\Visual Studio 2010\WebSites\WebSite2\sidebar.aspx 6

Error 24 'If' must end with a matching 'End If'. C:\Users\user\Documents\Visual Studio 2010\WebSites\WebSite2\sidebar.aspx 6

Error 26 Syntax error. C:\Users\user\Documents\Visual Studio 2010\WebSites\WebSite2\sidebar.aspx 22

UPDATEEEEEEEEEEEEEEE ! -> at top of my default.aspx is -> <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> and then i included my sidebar.aspx .... i dont know why sidebar run as VB ... i didnt use any page language at top of this file ... and it should use the default.aspx language

4
If it's expecting an end if, then it's trying to parse Visual Basic. I don't use .NET servers, but I'd think there's some way to change it to use C# instead.Kaleb Brasee

4 Answers

1
votes

Check the 'language' attribute in your <%@ Page %> directive. Make sure it is set to "c#" (the error message makes it sound like the page is using vb)

0
votes

change True to true. It's trying to compile as VB.NET

0
votes

Other than changing the "True", to "true", it works fine for me...are you sure the page is expecting C# code, and not VB code?

0
votes

An alternative:

if ( 1 == 1) {